Hi.....This is as part of my project.I am using Visual C#.I have a checkedlistbox and a listbox.Whenever I select an item in the checkedlistbox,it gets added into the listbox.Whenever I deselect that item,it gets removed from the listbox.The problem that I am having is if I double click an item in the checkedlistbox,the checked state of that item remains the same,but its contents are still added into the listbox.For example,if an item in the checkedlistbox has not been selected yet,then on doubleclicking that item,its state is unchecked again.Its contents should get added and then removed from the listbox.However the contents are still only added to the listbox and not removed.How do I handle this?I should check if the doubleclick event is occuring in the selectedindexchange event,but I dont know how to do it.Please help me.
nevds
0
Newbie Poster
Recommended Answers
Jump to PostAdd a DoubleClick event for the checkedListBox and call the "checkedListBox1_SelectedIndexChanged" event from there. Like this:
Private Sub CheckedListBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckedListBox1.DoubleClick CheckedListBox1_SelectedIndexChanged(Nothing, Nothing) End Sub}
Thanks
Jump to PostWhilst farooqaaa's code might get it done, its cleaner to use the ItemCheck event instead. This event is called every time the check state is changed so if you double click it will fir ethe event twice (once for checking and once for unchecking).
private void checkedListBox1_ItemCheck(object …
All 5 Replies
farooqaaa
48
Enthusiast
Geekitygeek
480
Nearly a Posting Virtuoso
nevds
0
Newbie Poster
farooqaaa
48
Enthusiast
Geekitygeek
480
Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.