| | |
Pause state?
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
if u have 2 commands and want the 2nd command to run after a certain interval of time, u can use the timer control.
During design time; set its interval property to ur required time of pause (in milliseconds), set Enable property to false
Now for the coding part, after the 1st command statement just Enable the timer. In the Timer() event of the timer, write the 2nd Command followed by Timer1.Enabled = False for the Timer control.
I assume that u have two command buttons and one timer control on your form. When the first command button is clicked it executes the statements and in the last statement of this event, the timer control is enabled. Once the timer control is enabled the counting starts and after an interval of 5000 ms the Timer() event is fired. There the call for the second command button click event is placed. After the execution of which the timer control is disabled.
If u dont disable the Timer control after the call for the Command2 click event, then Timer() event it is fired again and again for every 5000 ms.
Eg:
During design time; set its interval property to ur required time of pause (in milliseconds), set Enable property to false
Now for the coding part, after the 1st command statement just Enable the timer. In the Timer() event of the timer, write the 2nd Command followed by Timer1.Enabled = False for the Timer control.
I assume that u have two command buttons and one timer control on your form. When the first command button is clicked it executes the statements and in the last statement of this event, the timer control is enabled. Once the timer control is enabled the counting starts and after an interval of 5000 ms the Timer() event is fired. There the call for the second command button click event is placed. After the execution of which the timer control is disabled.
If u dont disable the Timer control after the call for the Command2 click event, then Timer() event it is fired again and again for every 5000 ms.
Eg:
vb Syntax (Toggle Plain Text)
Private Sub Form_Load() Timer1.Interval = 5000 'for 5 seconds Timer1.Enabled = False End Sub Private Sub Command1_Click() 'Write your code for the first command Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Call Command2_Click Timer1.Enabled = False End Sub Private Sub Command2_Click() 'Write your code for the Second Command End Sub
Last edited by aktharshaik; Dec 12th, 2008 at 1:30 am.
Regards
Shaik Akthar
Shaik Akthar
Hi,
use SLEEP API
Declare this at the top of the Form's Code window (After Option Explicit)
Regards
Veena
use SLEEP API
Declare this at the top of the Form's Code window (After Option Explicit)
vb Syntax (Toggle Plain Text)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'To Pause/Sleep for 10 seconds, write this code: Sleep(10000)
Regards
Veena
Thanks will try both
Should have explained what I was doing better.
Am running an update system over network to 2 remote TabletPC (when they get connected) been trying to show what was going on, what stage was getting worked on and completed.
I just put in a open dialog/form box for doing a refresh on other window then closing it and continuing.
Should have explained what I was doing better.
Am running an update system over network to 2 remote TabletPC (when they get connected) been trying to show what was going on, what stage was getting worked on and completed.
I just put in a open dialog/form box for doing a refresh on other window then closing it and continuing.
![]() |
Similar Threads
- Trying to check a remote connection! (Visual Basic 4 / 5 / 6)
- Cin won't pause even though I've flushed the input stream (I think) (C++)
- Attribute errors (Python)
- newbie comp science help (Python)
- "cannot resolve symbol"problem (Java)
- Newbie who is lost. (C++)
- admilliserve.exe removal (Viruses, Spyware and other Nasties)
- Making Norton Bootable (Mac Software)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: combo box searching problem
- Next Thread: Assistance
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





