VB题!刚学VB,求高手用VB知识帮忙,小女子各种感激

2025-01-02 19:50:01
推荐回答(2个)
回答1:

在窗体上添加2个列表框List1和List2,添加1个按钮Command1
设置List1的Style 属性为1,注意:该属性只能在设计时改变。
代码如下,复制了就能用:
Option Explicit

Private Sub Command1_Click()
Dim i As Integer
List2.Clear
For i = 0 To List1.ListCount - 1
If List1.Selected(i) Then
List2.AddItem List1.List(i)
End If
Next i
End Sub

Private Sub Form_Load()
Dim i As Integer
For i = 1 To 8
List1.AddItem i
Next i
End Sub

回答2:

在list1的右边的属性框里list属性里写广州,等名称
private sub command1_click()
list2.additem list1.text