Thread Closed

Converting listbox items to a string.

 
Share Thread Thread Tools
Sep9-08, 07:57 PM   #1
 
Question

Converting listbox items to a string.


It seems like it would be a fairly simple task, yet I have been unable to complete this task.
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Heat-related deaths in Manhattan projected to rise
>> Dire outlook despite global warming 'pause': study
>> Sea level influenced tropical climate during the last ice age
Sep9-08, 09:10 PM   #2
 
Admin
Blog Entries: 5
Quote by jazFunk View Post
It seems like it would be a fairly simple task, yet I have been unable to complete this task.
what language are you using?
 
Sep9-08, 09:55 PM   #3
 
I'm using VB.
 
Sep9-08, 10:58 PM   #4
 

Converting listbox items to a string.


try with Str(List1.List(x))
where x = the item # you want. Remember it starts from 0
 
Sep12-08, 09:05 PM   #5
 
That didn't work either. The error was that 'List is not a member of the 'Systems.Windows.Forms.ListBox'.

I try this with no error but it's not converting the items to a single string:

Dim OrigString As String = Me.lstLegend.Items.ToString()

Essentially I need to convert all of the items in a list box to a single string which can then be processed through a function.

Thanks, in advance.
 
Sep15-08, 04:26 PM   #6
 
Private Sub Command1_Click()

For x = 0 To 2
Label1.Caption = Label1.Caption & CStr(List1.List(x))
Next x

End Sub

That worked perfectly for me, try it. I had 3 items in my List.
 
Thread Closed
Thread Tools


Similar Threads for: Converting listbox items to a string.
Thread Forum Replies
… stuck in the Sent Items PM folder Forum Feedback & Announcements 7
Offensive Food Items General Discussion 17
9v Batteries Powering Multiple Items Electrical Engineering 3
single switch for two items Electrical Engineering 1
Checking for similar items in sets Set Theory, Logic, Probability, Statistics 8