Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 选中列表框_.net_Visual Studio 2008_C++ Cli - Fatal编程技术网

.net 选中列表框

.net 选中列表框,.net,visual-studio-2008,c++-cli,.net,Visual Studio 2008,C++ Cli,我想在选中列表框中的所有项目都未选中时执行一些操作。只有事件ItemCheck,但检查状态在ItemCheck事件发生后才会更新。 我有一个按钮,当选中列表框中的所有项目都未选中时,我想将其启用为false System::Void frmMain::clbInstPrgs_ItemCheck(System::Object^ sender, System::Windows::Forms::ItemCheckEventArgs^ e) { if ((clbInstPrgs->Check

我想在选中列表框中的所有项目都未选中时执行一些操作。只有事件ItemCheck,但检查状态在ItemCheck事件发生后才会更新。 我有一个按钮,当选中列表框中的所有项目都未选中时,我想将其启用为false

System::Void frmMain::clbInstPrgs_ItemCheck(System::Object^  sender, System::Windows::Forms::ItemCheckEventArgs^  e) {
 if ((clbInstPrgs->CheckedIndices->Count == 1)&&(rbnSelectSaveProgramms->Enabled)) {
        btnNext->Enabled = false;
     } else {
        btnNext->Enabled = true;
 }
    return;
}

如果只选中了一个项目,并且由于取消选中某个项目而处于事件处理程序中,那么最终将不会选中任何项目

这里是一个答案在VB中。应该很容易转换

btnNext.Enabled = Not (clbInstPrgs.CheckedItems.Count = 1 AndAlso e.NewValue = CheckState.Unchecked)

在回答这个问题之前,我们真的需要看一些代码。。。。