Question getting the selected items of a checklistbox into a tring array

rocks_lp

Member
Joined
Dec 16, 2008
Messages
15
Programming Experience
Beginner
i have a check list box. i am displaying the course names in that. user can check the courses they want to follow. they are allowed to select maximum of three courses. how can i get the checked course names into a string variable array.

i am planning to update my database by using those string array variables.

plzzz plzzzzzzz help me o this
 
Please don't do this:
plzzz plzzzzzzz
It's politer, quicker and less annoying just to type "please".

As for the question:
VB.NET:
Expand Collapse Copy
Dim items(Me.CheckedListBox1.CheckedItems.Count - 1) As String

Me.CheckedListBox1.CheckedItems.CopyTo(items, 0)
That assumes that the items in the CheckedListBox are Strings in the first place. If they're not then post back and I'll provide another example.
 
The code I posted works. I know that for a fact. If it's not working for you then you're doing something wrong. As you've chosen not to show us what you're doing or tell us what happens when you do it, I can't tell you what that might be.
 
Back
Top