Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CheckedListBox Help Please

Status
Not open for further replies.

ScarEye

MIS
Oct 22, 2003
33
US
Hi, guys I am new to .NET and programming in it self. SuperN00b you can call me. Anyway this is my questions. I have a form and on that form I have a CheckedListBox and it looks something like this...

All
Strawberry
Apple
Kiwi
Orange
Banana
Grape

Now when the user clicks on the indivdual fruit it puts a check next to it with no problem but what want to happen is that with the user clicks on the "All" checkbox I would like all of the items below to automatically be checked. And when he/she unchecks "All" I would like everything below to be unchecked Any idea how I would accomplish this ?


Thanks In Advance
ScarEye


Please note this is a CheckedListBox and NOT just a checkbox.
 

Private Sub CheckedListBox1_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles CheckedListBox1.ItemCheck
Dim l_iLoop As Integer

If e.Index = 0 Then
For l_iLoop = 1 To CheckedListBox1.Items.Count - 1
CheckedListBox1.SetItemChecked(l_iLoop, e.NewValue)
Next
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top