VB list 问题。。

来源:百度知道 编辑:UC知道 时间:2024/06/05 22:27:31
Dim a, b, c, d, e As String
a = Text1.Text
If Option1.Value = True Then
b = Option1.Caption
End If
If Option2.Value = True Then
b = Option2.Caption
End If
c = Combo1.Text
If Check1.Value = 1 Then
d = Check1.Caption
End If
If Check2.Value = 1 Then
d = d + "--" + Check2.Caption
End If
e = a + "--" + b + c + "--" + d
List1.AddItem e

这个是按下“添加”之后 在list里面添加相应的内容。。
但是 怎么才能 选中listbox中的某一项后,让其值显示到对应的对象中???
但是这里面除了textbox还有 check option combo
怎么整呢

Check1.Caption = List1.List(List1.ListIndex) '显示到 CheckBox
Option1.Caption = List1.List(List1.ListIndex) '显示到 OptionButton
Text1.Text = List1.List(List1.ListIndex) '显示到 TextBox
Combo1.Text = List1.List(List1.ListIndex) '显示到 ComboBox

Private Sub List1_Click()

Text1.Text = List1.List(List1.ListIndex)

End Sub

以上代码 是将 你所点击 的 listbox 中的项 显示在 textbox 中的代码

eee