|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Checklist box code help neededHi
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 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 Show quoteHide quote "John" <John@nospam.infovis.co.uk> schreef in bericht news:%23zM7zVAxGHA.4872@TK2MSFTNGP02.phx.gbl... > 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 > "John" <John@nospam.infovis.co.uk> wrote: As it happens, I've just been doing something similar.>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? 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 -- This is soc.men, we know better. -- Michael Snyder 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 Show quoteHide quote "Lost" <lostag***@mailinator.com> wrote in message news:44e85d72$0$17965$892e7fe2@authen.yellow.readfreenews.net... > "John" <John@nospam.infovis.co.uk> wrote: > >>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? > > 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 > > -- > This is soc.men, we know better. -- Michael Snyder
VoIP Dialer
Debug in .Net 2005 Invoking Class from a variable string in VB 2005...! How do I catch duplicate record exception? Application settings Convert IntPtr to Handle What port does My.Computer.Network.UploadFile work on? how to pass variable from one event to the other? Databinding a check list box Array Question |
|||||||||||||||||||||||