vb中单击组合框中的某一项时,此项添加到列表框中?该程序怎么编写?

大哥大姐,请说下,vb中单击组合框中的某一项时,此项添加到列表框中?该程序怎么编写?
最新回答
梦明

2024-06-01 00:06:01

在窗体上添加一个combo1和一个list1控件,输入以下代码:

Private Sub Form_Load()
Combo1.AddItem "AAA"
Combo1.AddItem "BBB"
Combo1.AddItem "CCC"
Combo1.AddItem "DDD"
End Sub

Private Sub Combo1_Click()
List1.AddItem Combo1.Text
End Sub
赵家小子

2024-06-01 00:12:28

Private Sub Form_Load()
With Combo1
.AddItem "a"
.AddItem "b"
.AddItem "c"
.ListIndex = 0
End With
End Sub

Private Sub Combo1_Click()
List1.AddItem Combo1.Text
End Sub