samedi 28 mars 2015

TextBox not being updated

I have a textBox2 on my windows form (confirmed name & spelling) I drug a timer from the toolbox over to my windows form and it is named timer1. I am trying to have the timer begin when the button is pressed and have textBox2 show each incrementing second so it shows a running time of how long the entire process has taken. Where did I err?



public partial class Form1 : Form
{
private int duration = 0;
private void button1_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
timer1.Start();
First();
Second();
Thirds();
Fourth();
Fifth();
timer1.Stop();
}
private void timer1_Tick(object sender, EventArgs e)
{
duration++;
textBox2.Text = duration.ToString();
}
}

Aucun commentaire:

Enregistrer un commentaire