How to store the system clock in a variable
-
Please i want your help with a code which i can use to store the system clock in a variable which i can use to add a 30 mints to it. as i want to my application to be shutdown after 30 mints when i click Start button but if the user click End button in another form then the timing should stop , and using the timer control was not helpful becuase it dose not accept any compare condition and just close the application. so i thought to ignore the timer control and use a code which i can store the system clock in a variable and insert that varialbe in a loop and inside the loop i compare the variable with specific value, if it is the desired value then close the application else go again and read the system clock , DO u think its good thinking. if u think its applicale , please help me a code to store the system clock in a variable. please advise and thank u for ur help Ali
-
Please i want your help with a code which i can use to store the system clock in a variable which i can use to add a 30 mints to it. as i want to my application to be shutdown after 30 mints when i click Start button but if the user click End button in another form then the timing should stop , and using the timer control was not helpful becuase it dose not accept any compare condition and just close the application. so i thought to ignore the timer control and use a code which i can store the system clock in a variable and insert that varialbe in a loop and inside the loop i compare the variable with specific value, if it is the desired value then close the application else go again and read the system clock , DO u think its good thinking. if u think its applicale , please help me a code to store the system clock in a variable. please advise and thank u for ur help Ali
Hi You have got it wrong! Declare a Public variable something like Public MyHalfAnHour as Integer If you have set the timer control as 1 minute. Keep incrementing the above variable in the timer control event and when the incremented value is 30, it means that 30 hour has lapsed and close the application else leave the application as it is. 2. When the user clicks the end button on the second form initialize the variable. I hope it helps!!! Kanniah
-
Please i want your help with a code which i can use to store the system clock in a variable which i can use to add a 30 mints to it. as i want to my application to be shutdown after 30 mints when i click Start button but if the user click End button in another form then the timing should stop , and using the timer control was not helpful becuase it dose not accept any compare condition and just close the application. so i thought to ignore the timer control and use a code which i can store the system clock in a variable and insert that varialbe in a loop and inside the loop i compare the variable with specific value, if it is the desired value then close the application else go again and read the system clock , DO u think its good thinking. if u think its applicale , please help me a code to store the system clock in a variable. please advise and thank u for ur help Ali
Dim StartTime As DateTime = DateTime.Now()
Dave Kreskowiak Microsoft MVP - Visual Basic
-
Hi You have got it wrong! Declare a Public variable something like Public MyHalfAnHour as Integer If you have set the timer control as 1 minute. Keep incrementing the above variable in the timer control event and when the incremented value is 30, it means that 30 hour has lapsed and close the application else leave the application as it is. 2. When the user clicks the end button on the second form initialize the variable. I hope it helps!!! Kanniah