Multiple Selection Listbox Text?

Hello again,

I am trying to grab the text from each a multi-selected listbox. I have run into the “Listbox.Text” only contains the text of the cell in the first column so I never get the other text entries using the following test code:

  Dim SelectedTech() as String
  for i as integer = 0 to TechToProcessListbox.ListCount-1
    if TechToProcessListbox.Selected(i) = True then
      msgbox TechToProcessListbox.Text
    End If
  Next i

I am trying to use this as a multi-select picklist. Any suggestions?

Thank you :slight_smile:

That’s the way to do it. You can tack the text onto an array, or maybe stuff it into a Dictionary with the index as the key.

As a point of optimization, you shouldn’t put calculations into the bounds of your For loop because they will be recalculated on every pass.

msgbox TechToProcessListbox.cell(i,0)

and it should work.

Thanks Kem!!

[quote=58809:@Christian Schmitz]msgbox TechToProcessListbox.cell(i,0)

and it should work.[/quote]
Thanks Christian!