c# - Runnings time in seconds in a Label -


i show current time in label. time should updated in realtime.

currently do:

txtdatetime.text = datetime.now.tolocaltime().tostring(); 

edit i'm using visual studio 2017 .net framework portable class library develop crossplatform mobile application.

sorry if unclear in making question

use timer , update label every second:

// declare timer field prevent garbage collection timer t = new timer();  // set values , event handler in form load (or similar) t.interval = 1000; t.tick += (x,y) => { txtdatetime.text = datetime.now.tolocaltime().tostring(); }; t.start(); 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -