Dim CN   As New ADODB.Connection                '定义数据库的连接
Dim Rs   As New ADODB.Recordset
Dim bln As BooleanPrivate Sub Command1_Click()
'停止
    bln = False
End SubPrivate Sub Command2_Click()
'开始
    bln = True
    Do While bln
        Make
    Loop
End SubPrivate Sub Form_Load()
    CN.ConnectionString = "Provider=sqloledb;Data Source=pmserver;Initial Catalog=northwind;User Id=sa;Password=sa;"
    CN.Open
    Rs.CursorLocation = adUseClient
    Rs.Open "select * from employees", CN, adOpenDynamic, adLockReadOnly
    bln = True
End SubPrivate Sub Make()
    Rs.MoveFirst
    Do Until Rs.EOF
        Text1.Text = Rs.Fields("FirstName")
        DoEvents
        If Not bln Then
            Exit Do
        End If
        Rs.MoveNext
    Loop
    
End Sub

解决方案 »

  1.   

    Private Sub Command1_Click()
    Dim MyTimer
    Dim Numberholder(6) As Integer
    For x = 0 To 19
        Randomize'初始化种子
        TheValue = Int((20 * Rnd) + 1)
        Numberholder(x) = TheValue
        Picture1(x).Picture = LoadResPicture(Numberholder(x), 0)
    Next x
    End Sub
      

  2.   

    Private Sub Command1_Click()
    Dim MyTimer
    Dim Numberholder(20) As Integer
    For x = 0 To 19
        Randomize'初始化种子
        TheValue = Int((20 * Rnd) + 1)
        Numberholder(x) = TheValue
        Picture1(x).Picture = LoadResPicture(Numberholder(x), 0)
    Next x
    End Sub