1) how do you get something to happen automatically after like 3 minutes ?
2) how do you get a button to be pressed automatically when you start a program ?
Thanks!!! :)
Printable View
1) how do you get something to happen automatically after like 3 minutes ?
2) how do you get a button to be pressed automatically when you start a program ?
Thanks!!! :)
1. user a timer control to determine when 3 minutes has past (180000 milliseconds)
2. call the click event in form_activate or main
For #2, use the following code:
Code:Private Sub Command1_Click()
MsgBox "You pressed the button"
End Sub
Private Sub Form_Load()
Command1 = True
End Sub
#1
VB Code:
Private Sub Form_Load() Me.Show Dim lStart As Long lStart = Timer '180 sec = 3 min Do Until Timer >= lStart + 180: DoEvents: Loop MsgBox "3 Min is up!" End Sub
ok thx but for the command what would it be frmmain.command1. ???
nevermind of thx :)
ok, neither of them worked :(
i just wanna do the one where a button it pressed once you start a program.
thx again :D
Use the code I gave you.
Just change Command1 to the name of your button.Code:Private Sub Command1_Click()
MsgBox "You pressed the button"
End Sub
Private Sub Form_Load()
Command1 = True
End Sub
VB Code:
Private Sub Form_Activate() Command2_Click End Sub
The problem with putting it in Activate(), though, is that it will be fired anytime the Form becomes the active form.
True, very true,
didn't even think of that :(
VB Code:
Private Sub Form_Load() Command2_Click End Sub