求VB 添加listbox代码
急!求30分钟内给全部代码 展开
就是对list的添加移除,很简单的
Private Sub Command1_Click()
Dim i As Integer
For i = 0 To List1.ListCount - 1
List2.AddItem List1.List(i)
Next
List1.Clear
End Sub
Private Sub Command2_Click()
If List1.Text <> "" Then
List2.AddItem List1.Text
List1.RemoveItem List1.ListIndex
End If
End Sub
Private Sub Command3_Click()
If List2.Text <> "" Then
List1.AddItem List2.Text
List2.RemoveItem List2.ListIndex
End If
End Sub
Private Sub Command4_Click()
Dim i As Integer
For i = 0 To List2.ListCount - 1
List1.AddItem List2.List(i)
Next
List2.Clear
End Sub
Private Sub Form_Load()
Dim i
For i = 1 To 10
List1.AddItem i
Next
List1.Selected(List1.ListIndex + 1) = True
End Sub