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

how to add preprocess loader in webpack 2 -

python - django admin: changing the way a field (w/ relationship to another model) is submitted on a form so that it can be submitted multiple times -

go - serving up pdfs using golang -