c# - reset button for a simple counter -


I am creating a very simple counter app for C # in Windows 7.1 using Visual Studio 2010.

I've added two buttons, one + and one - (for adding or subtracting) the results are being printed in a text block, which all work well.

Now I am trying to add a reset button to return zero to the text box and I'm struggling. I can exclude it with a toasting as 0. But the counter value does not reset to zero!

I know that this is a very simple problem to fix, but I'm coming out empty! Thank you.

  using the system; Using System.Collections.Generic; Using System.Linq; Using System.Net; Using System.Windows; Using System.Windows.Controls; Using System.Windows.Documents; Using System.Windows.Input; System.Windows.Media; Using System.Windows.Media.Animation; Using System.Windows.Shapes; Using Microsoft.Phone.Controls; Namespace PhoneApp1 {Public Partial Class Home Page: Phone Application Page {int counter = 0; // Constructor Public Manpage () {Initialization (); } Private Zero add_Tap (Object Sender, Gesture Event ARG) {Counter ++; Number. Text = counter Toasting (); } Private Zero subtract_Tap (Object Sender, GestureEventArgs e) {counter--; Number. Text = counter Toasting (); } Private Zero Button 1_Tap (Object Sender, GestureAgent ARG E) {// need to click on this button reset number (text block)}}  

}

  private zero button 1_Tap (object sender, gesture event ARGS E) {counter = 0; Number. Text = counter Toasting (); }  

You just give a text box and a counter number to which you want to set.

Why can not you use the counter - is optional, because the counter is not another, and gives the string () string.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -