一个VB获取随机数据的小程序,点击一下获取一个数字,怎么样编可以点击一下让他自己循环获取下去?
PrivateSubCommand1_Click()DimmyArray(1To1)AsStringmyArraystring=""Fori=1To1Step1myArr...
Private Sub Command1_Click()
Dim myArray(1 To 1) As String
myArraystring = ""
For i = 1 To 1 Step 1
myArray(i) = Int(100 * Rnd + 1)
myArraystring = myArraystring & " " & myArray(i)
Next i
Print "传感器显示温度为:"
Print myArraystring
End Sub
请高手赐教,点击一下,让他自己不断获取数据,循环指令或是计时器指令都可以,求代码?本人着急 不胜感激! 展开
Dim myArray(1 To 1) As String
myArraystring = ""
For i = 1 To 1 Step 1
myArray(i) = Int(100 * Rnd + 1)
myArraystring = myArraystring & " " & myArray(i)
Next i
Print "传感器显示温度为:"
Print myArraystring
End Sub
请高手赐教,点击一下,让他自己不断获取数据,循环指令或是计时器指令都可以,求代码?本人着急 不胜感激! 展开
展开全部
'点击一下显示,再点击停止
Private Sub Command1_Click()
If Timer1.Interval = 1000 Then Timer1.Interval = 0 Else Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim myArray(1 To 1) As String
myArraystring = ""
For i = 1 To 1 Step 1
myArray(i) = Int(100 * Rnd + 1)
myArraystring = myArraystring & " " & myArray(i)
Next i
Print "传感器显示温度为:"
Print myArraystring
End Sub
Private Sub Command1_Click()
If Timer1.Interval = 1000 Then Timer1.Interval = 0 Else Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim myArray(1 To 1) As String
myArraystring = ""
For i = 1 To 1 Step 1
myArray(i) = Int(100 * Rnd + 1)
myArraystring = myArraystring & " " & myArray(i)
Next i
Print "传感器显示温度为:"
Print myArraystring
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询