VB.NET - Detect when computer sleeps and wakes @JFLHV
VB.NET - Detect when computer sleeps and wakes  @JFLHV
Uploaded February 2018 | Updated September 2026, 1 week ago
Steps to detect when PC goes to sleep and wakes up in VB.NET.

.Net Framework 4.6.1
Windows Forms App
Visual Studio Community
Windows 10

#vbdotnet
----------------------

Imports Microsoft.Win32


Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

AddHandler SystemEvents.PowerModeChanged, AddressOf SystemEvents_PowerModeChanged

End Sub


Private Sub SystemEvents_PowerModeChanged(ByVal sender As Object, ByVal e As PowerModeChangedEventArgs)

Select Case e.Mode

Case PowerModes.Suspend
txtSuspend.Text = Now

Case PowerModes.Resume
txtResume.Text = Now

End Select

End Sub
End Class
VB.NET - Detect when computer sleeps and wakesGenerate text file of all items in a folder in Windows 10321 countdown green screen with soundBirthday reminders on Google PixelVB.NET - Automate desktop apps with Sendkeys and Win32 functionsVB.NET - Animated passive notification in WinformsC# - WPF .NET app in VS CodeiMovie - Video inside text effect10 basic shapes animated green screenParking spot Google Maps AndroidScan text from camera on Google Pixel.NET MAUI to Android Emulator from command line
JFLHV |

VB.NET - Detect when computer sleeps and wakes

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER