Link to home
Create AccountLog in
Avatar of Member_2_1343966
Member_2_1343966Flag for Greece

asked on

Make CheckedListBox Item selectable only over check

Hi there,

I have a CheckedListBox with some items.  Currently, no matter where I click on an item, it gets selected.  What I want to do is make the item selected only when I click on its check.

Any way of doing that?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Member_2_1343966

ASKER

Hi Idle_Mind,

Thank you for your comment!  I'll try it later today or tomorrow and let you know how it worked out.

Thanks!
Hi there,

Works as advertised :)

There is only one thing that's not working as I expected, and this is probably due to the way I posed the question.  The code that you provided deselects all items when we click on an item outside the checkbox area.  In that case however, I wanted the item to get selected, but not checked.  

In other words, I want the functionality of a CheckedListBox with item selection on double click.  However, when we click directly on the checkbox it should be selected/deselected using only one click.

Given the code above though, I see how I would go about doing that provided I can cancel the MouseUp event.  Is there a way?  I've seen an e.Cancel property but it doesn't appear in this case.
Lol...ok.  Let's start over as I'm confused as to what it should do now...trying to make sense of the first set of requirements with the second set.  =\

Given a non-modified CheckedListBox, what different functionality do you want?  What needs to be removed/added?
Hi there,

First of all, sorry for this...

It should behave exactly as the default CheckedListBox (CheckOnClick property set to False).  However, when we click directly on the CheckBox it should behave as if the CheckOnClick property was set to True.

Is this clearer?
Hi Idle_Mind,

Let me know if you plan on answering the "changed" question.  If not, I think I should still accept your first comment since it answered my question as I originally posed it.

Thanks...
Hi acicovic,

Sorry for the delay.  I just haven't gotten back to this question yet.  I'll play with it today...
ok, no problem.  It is not an emergency anyway, so you can take your time.