One start and stop button is there and one textbox is
there.when you click start button ,it will display
1,2,3......up to infinite in textbox.when you click stop
button it will stop.
Answer Posted / lince thomas
bool stopBtnClk = false;
bool startBtnClk = false;
private void BtnStart_Click(object sender, EventArgs e)
{
stopBtnClk = false;
startBtnClk = true;
int i = 1;
while (true)
{
textBox1.Text = i.ToString();
i += 1;
Application.DoEvents();
if (stopBtnClk == true)
{
break;
}
}
}
private void BtnStop_Click(object sender, EventArgs e)
{
stopBtnClk = true;
Application.Exit ();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Why do we use stringbuilder in c#?
What is Inheritance in C#?
What is sorted list in c#?
What is master page in asp net c#?
What are events in C#?
what optimizations does the c# compiler perform when you use the /optimize+ compiler option?
Can int be null in c#?
Where is c# compiler located?
How long does it take to get a loop recorder put in?
Does c# provide copy constructor?
Enlist all the components of an ado.net framework?
Are constructors inherited c#?
What is the resgen.exe tool used for?
Can we inherit a class with private constructor in c#?
What Happens In Memory When You Box And Unbox A Value-type?