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
How to block a class from being inherited further?
What is as keyword in c#?
Can we inherit two classes in c#?
What is the difference between ienumerable and enumerable?
Explain about ODP.net
Define constructor in c#.
What is pure abstract class in c#?
Can you use foreach iteration on arrays in c#?
What are the steps to create a webservice and consume it?
What is difference between dynamic and var in c#?
What is a trace and asset? Explain some differences?
I want to print "Hello" even before main() is executed. How will you achieve that?
What is the meaning of MSIL?
What is action in c# 3.5?
What is the main method in c#?