我想做一个随机抽取数字的程序,但是我想在界面上显示的是不断循环出现的数字,就
是不断的在转的,一直到按钮单击后停止,我想了很多方法都做不成,不知道到底该怎样做,望高人指点!

解决方案 »

  1.   

    先Randomize 
    然后用Rnd取:Randomize 
    debug.print Rnd
      

  2.   

    Option ExplicitPrivate Sub Command1_Click()
        
        Timer1.Enabled = False
        
    End SubPrivate Sub Timer1_Timer()
        
        Randomize
        Label1.Caption = Int(100 * Rnd() + 1)
        
    End Sub
      

  3.   

    Option ExplicitPrivate Sub Command1_Click()
        If Command1.Caption = "停止" Then
            Command1.Caption = "继续"
            Timer1.Enabled = False
        Else
            Command1.Caption = "停止"
            Timer1.Enabled = True
        End If
    End SubPrivate Sub Form_Load()
        Command1.Caption = "停止"
        Timer1.Interval = 50
    End SubPrivate Sub Timer1_Timer()
        Label1.Caption = Int(Rnd * 10000)
    End Sub
    '在窗体上加个CommandBox Timer Label
      

  4.   

    这是不用Timer的Dim fStop As BooleanPrivate Sub Command1_Click()
        Randomize Timer
        fStop = (Not fStop)
        
        Do While Not fStop
            Text1.Text = Format$(Int(10000000 * Rnd), "000000000")
            DoEvents
        Loop
    End SubPrivate Sub Form_Load()
        fStop = True
    End SubPrivate Sub Form_Unload(Cancel As Integer)
        fStop = True
    End Sub