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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get the text of a CheckedListBox item?

Status
Not open for further replies.

tmcnutt

Programmer
May 17, 2002
83
0
0
US
I have a CheckedListBox with several text fields and I want to assign the text of the selected items to a string array. I have tried to access the text via the items collection, but having no success.

Also, can I loop through the array and set the checked items in the CheckedListBox based off of the strings in the array?

Thanks,
Tom
 
I found a way to do this with the item collection. I didn't see the ToString function when I pressed the period to list the members, all I saw was "GetType".

Here is the code I used to save the text to a string array:
Pumps.Options(i) = CheckedListBox1.Items(i).ToString

Here is the code I used to check an item based off of a string value from the array:

CheckedListBox1.SetItemChecked(CheckedListBox1.FindString("Drip rim base"), True)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top