Converting listbox items to a string.

  • Thread starter Thread starter jazFunk
  • Start date Start date
  • Tags Tags
    String
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
5 replies · 14K views
jazFunk
Messages
12
Reaction score
0
It seems like it would be a fairly simple task, yet I have been unable to complete this task.
 
Physics news on Phys.org
try with Str(List1.List(x))
where x = the item # you want. Remember it starts from 0
 
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.
 
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.