Reputation: 81
I want a user to be able to click a value from the listbox and have the value selected become the textbox value. I'm getting an error from Textbox1.Value = selectedItems.Text
as a compile error: invalid qualifier for selecteditems
. I want the value selected to appear in the textbox as well.
Private Sub ListBox1_Click()
Dim selectedItems As String, i As Integer
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
selectedItems = selectedItems & ListBox1.List(i) & vbNewLine
End If
Next i
TextBox1.Value = selectedItems.Text
End Sub
Upvotes: 1
Views: 842
Reputation: 166316
selectedItems
is a String and strings don't have any properties such as Text
TextBox1.Value = selectedItems
would be what you need
Upvotes: 1