|
-
Oct 19th, 2009, 05:52 PM
#1
Thread Starter
Addicted Member
CheckList Box Help
Hum, im wondering how would i tell if user checked a box in the CheckList Box?
Im going to have alot so i need to keep it neet and tidy so it looks clean.
Thanks!
-
Oct 19th, 2009, 05:58 PM
#2
Re: CheckList Box Help
CheckedListBoxes have a special collection called "CheckedIndexes" which you can check the count of to see if anything is checked. I'm not 100% sure of the name of that collection is "CheckedIndexes" but it's something like that.
-
Oct 20th, 2009, 02:46 AM
#3
Addicted Member
Re: CheckList Box Help
CheckedListBox has 2 accessible properties to check for checked items: CheckedIndices() and CheckedItems(). Both properties point to different collection classes and are made to check using indices (integers) or items.
Anyone who has never made a mistake has never tried anything new. - Einstein
 Peace! 
-
Oct 20th, 2009, 06:32 AM
#4
Re: CheckList Box Help
vb.net Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With CheckedListBox1
If .CheckedItems.Count > 0 Then
For i As Integer = .CheckedItems.Count - 1 To 0 Step -1
'for this example I am adding what has been checked to
'a separate listbox. You do, here, whatever you need
'to do for any item that has been checked
ListBox1.Items.Add(.CheckedItems(i))
Next
End If
End With
End Sub
Last edited by Hack; Oct 20th, 2009 at 06:51 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|