大侠,帮帮VB菜鸟的问题吧~~

来源:百度知道 编辑:UC知道 时间:2024/07/04 01:55:24
怎么使单击列表框的某一项让他在文本框中显示一段信息,我都快愁死了,怎么就农不出呢,我感觉很简单,课就是不对,情高手帮忙啊~~谢谢了~~

Private Sub List1_Click()
Text1.Text = List1.Text
End Sub

Private Sub List1_Click()
Text1.Text = "你选择的是列表框的第" & list1.listindex+1 & "项:" & List1.Text
End Sub
文本框里显示的内容你可以按需要更改!

Private Sub Form_Load()
List1.Clear

List1.AddItem "A"
List1.AddItem "B"

End Sub

Private Sub List1_Click()

For I = 0 To List1.ListCount - 1

If List1.Selected(I) Then

Text1.Text = List1.List(I)

End If

Next I
End Sub

Private Sub Form_Load()
List1.AddItem "张三" '你预先在列表框中添加的内容
End Sub

Private Sub List1_Click()
Text1.Text = List1.Text '单击后显示的内容

End Sub

正确解答
Private Sub List1_Click()
For i = 0 To List1.ListCount - 1
If List1.Selected(i) Then
Text1.Text = List1.Text
End If
Next i
End Sub



Private Su