Perform your action when particular power mode is change in Vb.Net.

By James J

Show code how you can perform your operation for particluar pwer mode is there...


Dim WithEvents PowerModeChangeSystemEvent As SystemEvents

Private Sub PowerModeChangeSystemEvent_PowerModeChanged(ByVal sender As Object, ByVal e As Microsoft.Win32.PowerModeChangedEventArgs) Handles PowerModeChangeSystemEvent.PowerModeChanged

        Select Case e.Mode
            Case PowerModes.Resume
'When Power mode is on resume then perform your given action...
'write here your action...
            
Case PowerModes.StatusChange
'When Power mode is on status change then perform your given action...
'write here your action...
            
Case PowerModes.Suspend
'When Power mode is on suspend then perform your given action...
'write here your action...
            
Case Else
'write here your action...
        
End Select

End Sub

Perform your action when particular power mode is change in Vb.Net.  (803 Views)