Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am developing address book in vb.net. I have developed it, but now i want to minimize my form automatically when it is not used for more than one minute.
Please help me out.
Thanks
Posted

1 solution

Add a Timer to your form.
Set the timer Interval to 1000 (or one second in milliseconds) and add a Tick event handler
Add a class level private integer and set it to 60 - call it inactiveTime
In the Tick handler, check the value of inactiveTime. If it is zero, do nothing.
Otherwise, decrement it by one. If it is now zero, set the form WindowState to FormWindowState.Minimized
Whenever the user does anything you count as activity, set inactiveTime back to 60.
 
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