Home All Groups Group Topic Archive Search About

Checked List Box check in program

Author
19 Oct 2006 12:07 AM
Rick
VB.Net 2005

I would like to programatically check the check box in a CheckedListBox
control.

I don't see any examples in the help and have not googled up anything
either.

How do I do this?

Rick

Author
19 Oct 2006 1:41 AM
maligui
I would enumerate through the checked items of the listbox

        'To check by items
        Dim o As Object
        For Each o In Me.CheckedListBox1.CheckedItems
            'Stuff to do

            'Prints the item text that are checked
            Console.WriteLine(o)
        Next

        'By Index
        Dim i As Integer
        For Each i In Me.CheckedListBox1.CheckedIndices
            'Stuff to do

            Console.WriteLine(i)
        Next
Author
19 Oct 2006 11:21 AM
Rick
I found it. CheckedListBox.SetItemChecked

For some reason it did not show up in InteliSense and I could not get
answers in Google until I searched in this newsgroup.

Rick

Show quoteHide quote
"Rick" <R***@LakeValleySeed.com> wrote in message
news:%23E5NYKx8GHA.2120@TK2MSFTNGP03.phx.gbl...
> VB.Net 2005
>
> I would like to programatically check the check box in a CheckedListBox
> control.
>
> I don't see any examples in the help and have not googled up anything
> either.
>
> How do I do this?
>
> Rick
>