Groups | Blog | Home
all groups > vb.net data > august 2006 >

vb.net data : Checklist box code help needed


John
8/20/2006 12:00:00 AM
Hi

I have a check list box.When user selects a specific value '(All)' I want to
uncheck all other check boxes in the list. How can I achieve this in code?

Thanks

Regards

Cor Ligthert [MVP]
8/20/2006 12:00:00 AM
Tom,

If you detect that the all is checked than

remove the handler from the check event (or what you use)
than uncheck all boxes in a loop
check the all box again
add the handler again

And it is done,

If you want some sample code, than show at least the event that you are now
using.

I hope this helps,

Cor

"John" <John@nospam.infovis.co.uk> schreef in bericht
news:%23zM7zVAxGHA.4872@TK2MSFTNGP02.phx.gbl...
[quoted text, click to view]

Lost
8/20/2006 2:02:34 PM
[quoted text, click to view]

As it happens, I've just been doing something similar.

I'll assume your 'All' item is the top one (item 0).

Try this code:

If CheckedListBox1.GetItemChecked(0) = True Then
For i = 1 To CheckedListBox1.Items.Count - 1
CheckedListBox1.SetItemChecked(i, False)
Next i
End If

--
John
8/23/2006 5:15:06 PM
Thanks This worked. How can I make sure then when of the other options is
clicked then the All option is unticked?

Thanks again

Regards

[quoted text, click to view]

AddThis Social Bookmark Button