Results 1 to 2 of 2

Thread: Timer problem

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    41

    Timer problem

    I have a program which take the computer move using a simple ramdom () function

    but becos the computer porcess are really fast i would only see the last random number >.<

    is there a way to pause it for 1 or 2 sec at the start of the random process and stop the timer until the method is call again

  2. #2
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Create a new project - just a form with a button on it.

    Add this code.

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim i As Integer
    3.         Cursor.Current = Cursors.WaitCursor
    4.         For i = 1 To 20
    5.             f()
    6.         Next
    7.         Cursor.Current = Cursors.Default
    8.     End Sub
    9.  
    10.     Private Sub f()
    11.  
    12.         'Dim t As Date
    13.         't = Now
    14.         'Do
    15.         'Loop Until DateDiff(DateInterval.Second, t, Now) = 1
    16.  
    17.         Debug.WriteLine(Now)
    18.     End Sub

    When you click the button you will have the problem I think you are describing.

    Uncomment the code at the start of Sub f() and click the button again.

    Does this help?
    This world is not my home. I'm just passing through.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width