Results 1 to 7 of 7

Thread: Making a function wait a few

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Posts
    148

    Making a function wait a few

    Hello quick question here..

    Ive got a function that changes some things in the UI and id like it to go a little slower... How would I it wait x milliseconds?..

    CODE HERE
    WAIT A FEW SECONDS
    MORE CODE HERE

    Thanks.

  2. #2
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    Here you go:

    VB Code:
    1. 'In the General Declarations
    2. Dim i as Integer
    3. '-------------------------------------------------------------------------------
    4.  
    5. Your Sub()
    6.  
    7.     MORE CODE HERE
    8.     Timer1.Start()
    9.  
    10. End Sub
    11. '-------------------------------------------------------------------------------
    12. Timer1_Tick()
    13.  
    14. i = i + 1
    15.  
    16.     If i = value Then
    17.         CODE HERE
    18.         Timer1.Stop()
    19.     End If
    20.  
    21. End Sub


    gL,
    Furry
    Eat long and prosper!
    If someone helps you, find someone you can help.
    If you still have time, click on the darn banner up there and help the forum!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Posts
    148
    Hum, any way without a timer? Kinda like to keep all the code for this in one place..

    Thanks.

  4. #4
    Member
    Join Date
    May 2002
    Location
    Malaysia
    Posts
    45
    hOW ABOUT AS FOLLOW:

    Private sub YourFunction()

    Your function code....
    Application.Doevents
    thread.CurrentThread.sleep(1000)
    end sub

  5. #5
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    Ahh - I didn't know you could do that!
    Eat long and prosper!
    If someone helps you, find someone you can help.
    If you still have time, click on the darn banner up there and help the forum!

  6. #6
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    the bad thing is that your program doesnt respond in that time umm unless you can call the sub as a separate thread?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Posts
    148
    Yay it works, and i threaded the function so it doesnt lag anything.

    .NET WILL LIVE ON!

    Thanks.

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