starting an application on timer

J

jdrott1

i'm trying to run an application2 automatically 60 secs after
application1 starts. application1 would have the code to start
application2.

Load_Event for application1

Try
System.Diagnostics.Process.Start("c:\application2.exe")
Catch ex As Exception
MsgBox("Error: " & ex.Message)
End Try

how would i tie a timer function in to this so it could count down
from 60 to 0 and start my application?
 
K

kimiraikkonen

i'm trying to run an application2 automatically 60 secs after
application1 starts.  application1 would have the code to start
application2.

Load_Event for application1

Try
            System.Diagnostics.Process.Start("c:\application2.exe")
        Catch ex As Exception
            MsgBox("Error: " & ex.Message)
        End Try

how would i tie a timer function in to this so it could count down
from 60 to 0 and start my application?

Hi,
First place the timer on application1 which is your project's
application and set timer to "enabled" and set interval to "60000"
miliseconds = 60 seconds.

Then put the following code in timer1's tick event:
(double click on timer to open tick event sub):


Try
System.Diagnostics.Process.Start("c:\application2.exe")

' Put this to avoid your application to be executed more than once
timer1.enabled = False

Catch ex As Exception
MsgBox("Error: " & ex.Message)
End Try


Thanks,

Onur Güzel
 
C

Cor Ligthert[MVP]

Jdrott,

Drag a timer on the surface of your application and fill in all properties.

Then use the event of that.

Cor
 
M

Miro

Dont forget in your timer to set 'Timer1.Enabled = False' after the event
fires (within the event), or you will have the event firing over and over
again constantly opening up the new software.

You can make the enabled=false the first line in the event. The rest of the
event will be executed still.

-Unless that is what you want :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top