建立一个列表框,在列表框中有8个学生的姓名,当选定某个学生的姓名后,单击显示学生
姓名后,单击显示学生籍贯按扭,在文本框上显示出该学生的籍贯,如果用户双击学生姓名,也能在文本框中显示学生的籍贯信息(vb程序题)我的邮箱是dongniaxing@sina...
姓名后,单击显示学生籍贯按扭,在文本框上显示出该学生的籍贯,如果用户双击学生姓名,也能在文本框中显示学生的籍贯信息(vb程序题)我的邮箱是dongniaxing@sina.com
展开
1个回答
展开全部
Option Explicit
Dim arr(7, 1)
Private Sub Command1_Click()
Dim i
If List1.ListIndex > 0 Then Text1 = arr(List1.ListIndex, 1)
Command1.Visible = False
End Sub
Private Sub Form_Load()
Dim a, b, i
a = Split("a,b,c,d,e,f,g,h", ",")
b = Split("广州,深圳,哈尔滨,长春,沈阳,大连,济南,青岛", ",")
For i = 0 To 7
arr(i, 0) = a(i)
arr(i, 1) = b(i)
List1.AddItem a(i)
Next
Text1 = ""
Command1.Visible = False
End Sub
Private Sub List1_Click()
Command1.Visible = True
End Sub
Private Sub List1_DblClick()
Command1_Click
End Sub
Dim arr(7, 1)
Private Sub Command1_Click()
Dim i
If List1.ListIndex > 0 Then Text1 = arr(List1.ListIndex, 1)
Command1.Visible = False
End Sub
Private Sub Form_Load()
Dim a, b, i
a = Split("a,b,c,d,e,f,g,h", ",")
b = Split("广州,深圳,哈尔滨,长春,沈阳,大连,济南,青岛", ",")
For i = 0 To 7
arr(i, 0) = a(i)
arr(i, 1) = b(i)
List1.AddItem a(i)
Next
Text1 = ""
Command1.Visible = False
End Sub
Private Sub List1_Click()
Command1.Visible = True
End Sub
Private Sub List1_DblClick()
Command1_Click
End Sub
更多追问追答
追问
编译时有错误,是变量未定义
追答
控件都有了?检查一下,感觉缺少控件。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询