I just downloaded the Microsoft Visual Basic 2012 RC and wanted to create my first Windows program. I have a small knownledge on VB and know only basic coding, I also only have a small basic view on how the software works.
I wish to make a program where after the computer is idea for x time the computer will shut off. I also want to add that the software will only enable after 12:00 AM.
I have this code here:
Public Class Idle Private Sub Idle_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'You should have already set the interval in the designer... Timer.Start() End Sub Private Sub Idle_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress Timer.Stop() Timer.Start() End Sub Private Sub Idle_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove Timer.Stop() Timer.Start() End Sub Private Sub Idle_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick Timer.Stop() Timer.Start() End Sub Private Sub Timer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer.Tick Application.Exit() 'I just have the program exiting, though you could have it do whatever you want. End Sub End Class
But not sure how it all works or what do I need to add to the program so it works. I understand I need a timer but does this code go in the timer? How do I get the display of the program to look nice?
Thanks for the help!