有6个Text1
点击开始  想让这六个Text1分别都从1-9滚动显示数字停止
就取得一个六位的数

解决方案 »

  1.   

    Option Explicit
        Dim flag As Boolean
    Private Sub Command1_Click()
        If flag Then
            Timer1.Enabled = False
            Command1.Caption = "Open"
        Else
            Timer1.Enabled = True
            Command1.Caption = "Close"
        End If
        flag = Not flag
    End SubPrivate Sub Form_Load()
        Timer1.Interval = 50
        Timer1.Enabled = False
        Command1.Caption = "Open"
    End SubPrivate Sub Timer1_Timer()
        Dim MyValue
        Randomize   ' 对随机数生成器做初始化的动作。
        MyValue = Int(1000000 * (Rnd) + 1)
        Text1(0) = Mid(MyValue, 1, 1)
        Text1(1) = Mid(MyValue, 2, 1)
        Text1(2) = Mid(MyValue, 3, 1)
        Text1(3) = Mid(MyValue, 4, 1)
        Text1(4) = Mid(MyValue, 5, 1)
        Text1(5) = Mid(MyValue, 6, 1)
    End Sub
      

  2.   

    Private Sub Timer1_Timer()
        Randomize (1)
        Text1(0) = Int((9 * Rnd) + 1)
        Text1(1) = Int((9 * Rnd) + 1)
        Text1(2) = Int((9 * Rnd) + 1)
        Text1(3) = Int((9 * Rnd) + 1)
        Text1(4) = Int((9 * Rnd) + 1)
        Text1(5) = Int((9 * Rnd) + 1)
    End Sub