发布网友 发布时间:2022-04-26 16:43
共5个回答
热心网友 时间:2023-10-15 01:49
是不是要上图的效果?刚发现要有序的,在后面补上了有序的代码
无序的代码:
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "开始" Then
CommandButton1.Caption = "停止"
TextBox1.Text = Format(Int(Rnd * 99 + 1), "00")
Else
CommandButton1.Caption = "开始"
End If
End Sub
Private Sub TextBox1_Change()
Do
Call delay(0.1) '在这里调节随机的速度,现在是0.1秒变化一次,根据自己意愿调整
If CommandButton1.Caption = "开始" Then Exit Sub
TextBox1.Text = Format(Int(Rnd * 99 + 1), "00")
Loop
End Sub
Private Sub delay(T As Single)
Dim T1 As Single
T1 = Timer
Do
DoEvents
Loop While Timer - T1 < T
End Sub
有序的代码:
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "开始" Then
CommandButton1.Caption = "停止"
TextBox1.Text = Format(1, "00")
Else
CommandButton1.Caption = "开始"
End If
End Sub
Private Sub TextBox1_Change()
Do
Call delay(0.1)
If CommandButton1.Caption = "开始" Then Exit Sub
If TextBox1.Text = 99 Then
TextBox1.Text = Format(1, "00")
Else
TextBox1.Text = Format(TextBox1.Text + 1, "00")
End If
Loop
End Sub
Private Sub delay(T As Single)
Dim T1 As Single
T1 = Timer
Do
DoEvents
Loop While Timer - T1 < T
End Sub
热心网友 时间:2023-10-15 01:49
你好,我改写成3个框显示,奇怪就不同步了,请问哪问题?热心网友 时间:2023-10-15 01:50
简单,用DO循环就可以热心网友 时间:2023-10-15 01:50
可以 现在已完成1表转变热心网友 时间:2023-10-15 01:51
别用Excel做,用什么都比这个好做