windows - How to make DispatcherTimer show time in a textbox and perform action when reaches a certain time in C#? -


This is my second question on stack overflow. I had posted my first question some time ago and in no time did not get the answer to work, very impressed, very appreciated.

Anyway, what should I know, how to make a display timer work and show time in a fixed text box and stop it from reaching a certain time (we say 60 seconds) And do a function after 60 seconds

I'm basically using it for:

Creating a game, which is discontinued after 60 seconds and scores or related Show stuff So it requires me to show time in a text box and then 60 seconds or later to do the function.

Here's more information:

The textbox is called "timer box"

Whatever code I've tried here:

  DispatcherTimer DT = New Dispatcher Timer (); Private Zero TimerStart (Object Sender, Routing Avenger EG E) {dt.Interval = TimeSpan.FromSeconds (1); Dt.Tick + = dt_Tick; Dt.Start (); } Int count = 0; Zero dt_Tick (object sender, object e) {count = count + 1; TimerBox Text = convert Toasting (calculation); }  

This text does not show the time in the box, I do not even know how to stop it and at any point.

Thank you for reaching here, please leave the answer with full explanation as I am starting the whole :)

PS I used the Windows Store app development in Visual Studio 2013 I am using the environment. And it does not have a "timer" because it is in the normal C # environment.

AoA I am just starting to learn C # (interested in windows form). Hope this will help you.

If you want to set a timer for a curtain event .....

recommend using the timer (in the toolbox) ...... < / P>

Follow the steps, when you double click timer 1 VS, then you create a timer 1 stop function for which you are called Timer Tyke ..... Now when you call timer 1 ix If you write it then what do you want to do .... like this ....

  Private zero timer 1 volt (object sender, event RGS E) {// enter your code here}  

Now write Timer 1 and VS The list of available functions will be displayed .... For example,

  timer 1. Interval = (60 * 1000); Enter the time in // millisecond  

Now when you want to start typing ......

  timer1.start ();  

and to stop the timer on the timer call

  timer 1 .top ();  

If you repeat the timer, then the timer 1 in that tick function. Start () ...

Plus, use something like the text box text to set the timer 1 equivalent

  textbox1.Text = convert .ToString (timer1.Interval); 

Html>

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -