Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling system time change in windows application

I have a windows application and I want any event when user changes the time of that system on which that windows application is opened or running.

How can I get that changed time or specific time or any event of system change of time/date?

like image 225
k-s Avatar asked Aug 14 '13 11:08

k-s


1 Answers

You can subscribe to SystemEvents.TimeChanged event.

To subscribe to above event, do the following:

1.Create TimeChanged EventHander.

    private void time_Changed(object sender, EventArgs e)
    {
       MessageBox.Show("Time Changed");  
    }

2.Add above event handler to SystemEvents.TimeChanged event.

 SystemEvents.TimeChanged += time_Changed;
like image 101
Akash KC Avatar answered Oct 05 '22 10:10

Akash KC