Board index » cppbuilder » Item Value in TCheckListBox

Item Value in TCheckListBox

I am dyncamically filling a TCheckListBox, after the user select one item in
the list, how do you retrieve the text of the item selected ?
 

Re:Item Value in TCheckListBox


Quote
"Fark You" <f...@you.com> wrote in message

news:3ec27e23$1@newsgroups.borland.com...

Quote
> I am dyncamically filling a TCheckListBox, after the
> user select one item in the list, how do you retrieve
> the text of the item selected ?

Use the ItemIndex property to know the index of the item that is selected,
then simply pull that value from the Items property:

    int index = CheckListBox1->ItemIndex;
    if( index != -1 )
    {
        AnsiString str = CheckListBox1->Items->Strings[index];
        // use str as needed
    }

Gambit

Other Threads