Hello,
How I can to obtain data from Listbox ?
I have a list box where I can to choose some item.
How I can to put selected item into the variable ?
Can You help me somedoby ?
Printable View
Hello,
How I can to obtain data from Listbox ?
I have a list box where I can to choose some item.
How I can to put selected item into the variable ?
Can You help me somedoby ?
A listbox can either be setup (properties) as a single selection type only, or a multi-selection type.
Assuming you only have 1 selection enabled, you need to scan the listbox items first to find out which one is selected:
If Mylistbox.ListIndex <> - 1 Then
For X = 0 To Mylistbox.ListCount - 1
If Mylistbox.Selected(X) = True Then MyString= Mylistbox.List(X)
Next X
Else
'Nothing in the list was selected......
End If
If the Listindex property is "-1", then nothing has been selected