vb6中,如何把listbox里选中的所有项导入一个数组
最佳答案
Dim a() As String
ReDim a(List1.ListCount - 1)
For i = 0 To List1.ListCount - 1
a(i) = List1.List(i)
Next
'这里a()就是list内容
追问:
这个是所有项,不是被选中项吧 追答:
没注意你是要选中的,以下的可以Private Sub Command1_Click()Dim a() As StringReDim a(List1.SelCount - 1)j = 0For i = 0 To List1.ListCount - 1If List1.Selected(i) Then a(j) = List1.List(i) j = j + 1 End If Next End Sub
追问:
If List1.Selected(i) = True 嘻嘻
最佳答案由网友 whoami1978 提供
其他回答
暂无其它回答!