Results 1 to 4 of 4

Thread: CheckList Box Help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2009
    Posts
    198

    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!

  2. #2
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    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.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  3. #3
    Addicted Member garyjohn_2000's Avatar
    Join Date
    Apr 2005
    Location
    Timbaland
    Posts
    243

    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!

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: CheckList Box Help

    vb.net Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         With CheckedListBox1
    3.             If .CheckedItems.Count > 0 Then
    4.                 For i As Integer = .CheckedItems.Count - 1 To 0 Step -1
    5.                     'for this example I am adding what has been checked to
    6.                     'a separate listbox.   You do, here, whatever you need
    7.                     'to do for any item that has been checked
    8.                     ListBox1.Items.Add(.CheckedItems(i))
    9.                 Next
    10.             End If
    11.         End With
    12. 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
  •  



Click Here to Expand Forum to Full Width