We help IT Professionals succeed at work.
Get Started

Why does a checkedListBox fire the checkchanged when not clicking on the item

1,091 Views
Last Modified: 2013-11-26
I am using VB.Net 2008 in a windows form.  I am using a CheckedListBox that has several items in it.  Several items are checked and not checked.   The strange part is when I have an item selected, but click on the lower part of the list where there are no rows, it is changing the state of the checkbox even when I am not anywhere near the checkbox!   How do I stop this from happening.  My users are going to freak out if they see the checkbox change when they click on the white area of CheckedListbox where there are no items.   The problem is this event is firing other logic that I do not want to happen unless they really mean to check the item.  I need to know when they really check on the box not on bogus white space in the box.   We could use HitTest on other controls, but HitTest is not an option on this control

By the way  CheckOnClick is set to false

It seems ridiculous that the ItemCheck and SelectedValueChanged events fire when clicking on the white space of a CheckedListbox...   I don't see any way to trap that an item was really checked/unchecked.  I don't want this event fired on the current selected item when I click on the white space under the items.  Sounds like a bug to me, but maybe I am missing something...  

I still need to be able to use the SelectedIndexChange event to know when an item is selected, but I also need to know when an actual checkbox in the control is checked/unchecked properly not by clicking on white space below the items.

Any help would be appreciated
Comment
Watch Question
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE