VB 标签里随机产生数
发布网友
发布时间:2023-10-11 01:46
我来回答
共3个回答
热心网友
时间:2024-08-03 18:01
Private Sub cmdRnd_Click()
labRnd.Caption = Int(Rnd * 100000 + 100) Mod 100000
End Sub
'labRnd 那个标签
'cmdRnd 那个命令按钮
热心网友
时间:2024-08-03 18:01
Dim i As Integer
Const n = 5
Dim x(n) As Integer '定义个数组来存放随机数,当然,可以不要这个数组也可,
'直接来一句代码 a = a & Int(Rnd * 1000) & " "
'甚至不要a变量都可以,用
'label1.caption=label1.caption & Int(Rnd * 1000) & " "
'当然,一开始要把label1.caption设为空.不然,影响查看
Private Sub command1_Click()
a = " "
For i = 1 To n
x(i) = Int(Rnd * 1000)
a = a & x(i) & " "
Next i
Label1.Caption = a
End Sub
热心网友
时间:2024-08-03 18:02
Private Sub command1_Click()
Randomize
Dim x$(4)
For i = 0 To 4
x(i) = Int(Rnd * 900) + 100
Next
Label1 = Join(x, ",")
End Sub