Delay in VB? menu

Shout-Out

User Tag List

Thread: Delay in VB?

Results 1 to 6 of 6
  1. #1
    miLl3niUm's Avatar Member
    Reputation
    16
    Join Date
    Jun 2009
    Posts
    312
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Delay in VB?

    I have done this to implement a delay function:

    Code:
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Code:
    lblStatus.Text = "Please wait"
    Sleep(3000)
    lblStatus.Text = "Test"
    Sleep(3000)
    lblStatus.Text = "asd"
    But what it does is to wait 6 seconds and set label text to asd, instead of please wait -> 3sec -> test -> 3sec -> asd.

    Any solutions? (using visual studio

    Delay in VB?
  2. #2
    flippert112's Avatar Member
    Reputation
    4
    Join Date
    Jun 2009
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm guessing that your form isn't "repainting" itself after you set the label text to "Test". Instead of "repainting" it immediately falls asleep again, and right when it wakes up it changes the text to "asd" and then has time to repaint.

    Try doing a "MyFormName.Refresh()" right after you set the text to "Test". (with "MyFormName" being whatever your form's name is of course)

  3. #3
    miLl3niUm's Avatar Member
    Reputation
    16
    Join Date
    Jun 2009
    Posts
    312
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you flipper, it worked. Something weird I have noticed VB considered using "Form.Refresh()" as error and I had to use "Me.Refresh()" instead.. lol. +Rep if I can (edit: +Rep added)

  4. #4
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use Invalidate() instead of Refresh.

  5. #5
    miLl3niUm's Avatar Member
    Reputation
    16
    Join Date
    Jun 2009
    Posts
    312
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is no such command for the form (Me.Invalidate()) but there is for the label. Though, it doesn't update.

  6. #6
    sired22's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    does this help you any?

    Code:
    lblStatus.Text = "Please wait"
    
    Application.DoEvents()
    'multiply by 1000 for 3 seconds
    System.Threading.Thread.Sleep(3 * 1000)
    
    lblStatus.Text = "Test"
    
    Application.DoEvents()
    System.Threading.Thread.Sleep(3 * 1000)
    
    lblStatus.Text = "asd"

Similar Threads

  1. 2.4 delayed again
    By Chuck Norris in forum World of Warcraft Emulator Servers
    Replies: 21
    Last Post: 04-14-2008, 09:04 PM
  2. Warhammer Online delayed (again)
    By KuRIoS in forum Gaming Chat
    Replies: 3
    Last Post: 03-30-2008, 09:43 AM
  3. 2.3.2 [Hunter] No auto-shot delay -> super DPS
    By beerie in forum World of Warcraft Exploits
    Replies: 62
    Last Post: 01-12-2008, 11:57 AM
  4. S3 Delayed Nov 27th
    By Kyiz in forum World of Warcraft General
    Replies: 6
    Last Post: 11-15-2007, 10:47 PM
  5. Auto Reply (with delay) [Set-up in 5 minutes]
    By Paperboi in forum World of Warcraft Bots and Programs
    Replies: 3
    Last Post: 03-05-2007, 09:56 AM
All times are GMT -5. The time now is 09:08 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search