Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i need to run a form for 5 hours from the first form load.
how can i check how long is it being started to run the form?
"time< 5" this condition is not acceptable,how can i change this in order to get the time value?
please help me.

private void mainpg_Load(object sender, EventArgs e)
{
DateTime time=timer1.Start();
if (time< 5)
{
//remain in the same form
main_test one = new main_test();
one.MdiParent = main.ActiveForm;
one.Show();
}
else if(time >= 5)
//exit from the application.
}
Posted

1 solution

The way you are trying to implement is wrong.

Check the documentation here[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900