VB的题目,从列表框中选择任意三个显示在标签里。新手,请多帮忙!
'列表框有10个选项,要求按一次,就会在旁边三个标签中随机显示出三个选项,而且各不相同,请问如何让这三个随机选项不同?OptionExplicitPrivateSubCo...
'列表框有10个选项,要求按一次,就会在旁边三个标签中随机显示出 三个选项,而且各不相同,请问如何让这三个随机选项不同?
Option Explicit
Private Sub Command1_Click()
Label1.Caption = List1.List(Int(Rnd() * 10 + 1))
Label2.Caption = List1.List(Int(Rnd() * 10 + 1))
Label3.Caption = List1.List(Int(Rnd() * 10 + 1))
End Sub
Private Sub form_load()
List1.AddItem "中华门"
List1.AddItem "草场门"
List1.AddItem "光华门"
List1.AddItem "挹江门"
List1.AddItem "解放门"
List1.AddItem "凤台门"
List1.AddItem "中华门"
List1.AddItem "高楼门"
List1.AddItem "兴中门"
List1.AddItem "凯旋门"
List1.AddItem "中华门"
End Sub 展开
Option Explicit
Private Sub Command1_Click()
Label1.Caption = List1.List(Int(Rnd() * 10 + 1))
Label2.Caption = List1.List(Int(Rnd() * 10 + 1))
Label3.Caption = List1.List(Int(Rnd() * 10 + 1))
End Sub
Private Sub form_load()
List1.AddItem "中华门"
List1.AddItem "草场门"
List1.AddItem "光华门"
List1.AddItem "挹江门"
List1.AddItem "解放门"
List1.AddItem "凤台门"
List1.AddItem "中华门"
List1.AddItem "高楼门"
List1.AddItem "兴中门"
List1.AddItem "凯旋门"
List1.AddItem "中华门"
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询