ListView...ItemCheck event..make some items hidden..but how?? again....
-
hi! I ask this few days ago. but no one answert me.. therefore I ask over again.. ;) what I want to do.... when an user checked one item in the ListView the other items must come hidden. or: when an user checked one item in the ListView the other items must come hidden and after the user cheched the second time at this item all items was visible.... (I will make it to allowed the user to checked only 1 item) the even I will use is: private void displayCustomerListView_ItemCheck(object sender,System.Windows.Forms.ItemCheckEventArgs e) { for (int i = 0; i < displayCustomerListView.Items.Count; i++) { if(!(displayCustomerListView.Items[i].Index == e.Index)) { //and here must stand the code that make the Items[i] checkbox unvisible or unable to check } } } have anyone an idea how I can make this? (at best would help me a code sample in C#) big THX!! PAWEL
-
hi! I ask this few days ago. but no one answert me.. therefore I ask over again.. ;) what I want to do.... when an user checked one item in the ListView the other items must come hidden. or: when an user checked one item in the ListView the other items must come hidden and after the user cheched the second time at this item all items was visible.... (I will make it to allowed the user to checked only 1 item) the even I will use is: private void displayCustomerListView_ItemCheck(object sender,System.Windows.Forms.ItemCheckEventArgs e) { for (int i = 0; i < displayCustomerListView.Items.Count; i++) { if(!(displayCustomerListView.Items[i].Index == e.Index)) { //and here must stand the code that make the Items[i] checkbox unvisible or unable to check } } } have anyone an idea how I can make this? (at best would help me a code sample in C#) big THX!! PAWEL
-
To uncheck an item:
displayCustomerListView.Items[i].Checked = false
-- David Wengier Sonork ID: 100.14177 - Ch00k
-
hi! I ask this few days ago. but no one answert me.. therefore I ask over again.. ;) what I want to do.... when an user checked one item in the ListView the other items must come hidden. or: when an user checked one item in the ListView the other items must come hidden and after the user cheched the second time at this item all items was visible.... (I will make it to allowed the user to checked only 1 item) the even I will use is: private void displayCustomerListView_ItemCheck(object sender,System.Windows.Forms.ItemCheckEventArgs e) { for (int i = 0; i < displayCustomerListView.Items.Count; i++) { if(!(displayCustomerListView.Items[i].Index == e.Index)) { //and here must stand the code that make the Items[i] checkbox unvisible or unable to check } } } have anyone an idea how I can make this? (at best would help me a code sample in C#) big THX!! PAWEL
If only one item can be selected why are you using the CheckListBox in the first place? Its very nature implies that you can select multiple items. If you only want to allow one item to be selected you should use a normal ListBox or create your own control that does what the CheckListBox does but uses Radio buttons instead of check boxes. James Sonork: Hasaki "I left there in the morning with their God tucked underneath my arm their half-assed smiles and the book of rules. So I asked this God a question and by way of firm reply, He said - I'm not the kind you have to wind up on Sundays." "Wind Up" from Aqualung, Jethro Tull 1971