.net - I want to show any selected item from CheckedListBox in a ListBox in C# -
I have a Windows form that contains the name of a "Cheklistbstboks" is "ChkBox1" and this item (blue, red, Green, yellow).
This form includes a blank "listbox" called "LstBox1".
I do when I unchecked it "ChkBox1" any item check them, it "LstBox1" and when I "ChkBox1" was removed from "LstBox1".
I think I should use "items Checkered" event, but I can not figure out how it before or not, it's another list.
This is my attempt:
private void chkBox1_ItemCheck (object sender, ItemCheckEventArgs e) {if (ChkBox1.CheckedItems.Count & gt; 0) listBox1 .Items.Add (ChkBox1.Items [e.Index]); Otherwise If (ChkBox1.CheckedItems.Count == 0) listBox1.Items.Remove (ChkBox1.Items [e.Index]); }
But when I check it, I can not uncheck it.
And it another try:
private void ChkBox1_ItemCheck (object sender, ItemCheckEventArgs e) {if (ChkBox1.GetItemChecked (e.Index) == true) listBox1 .ems.Add (ChkBox1.Items [e.Index]); Else if (ChkBox1.GetItemChecked (e.index) == incorrect) listBox1.Items.Remove (ChkBox1.Items [e.Index]) ;; }
try this:
private zeros chkBox1_ItemCheck (Object Sender, MoodleEventErgus E) {If (e New Zealand == CheckState is checked) {listBox1.Items.Add (ChkBox1.Items [e.Index]); } And {listBox1.Items.Remove (ChkBox1.Items [e.Index]); }}
Comments
Post a Comment