我希望用户能够从列表框中单击一个值,并使选定的值成为文本框值。我从Textbox1.Value = selectedItems.Text
得到一个编译错误:selecteditems
的限定符无效。我希望选定的值也出现在文本框中。
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
发布于 2019-11-12 19:16:58
selectedItems
是一个字符串,并且字符串没有任何属性,如Text
TextBox1.Value = selectedItems
将是你所需要的
https://stackoverflow.com/questions/58825213
复制相似问题