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
What is attribute c#?
How can i Spawn a Thread
Does main have to be static c#?
Are c# strings immutable?
You have got 1 million parking slots. At a time a parking slot can be free or not. To get next slot easily which data structure to implement?
Does c# do array bounds checking?
Is type nullable c#?
What are delegates?
What is difference between a type and class?
What's different between c# and c/c++?
Why do we need oops in c#?
Can a class have static constructor?
What is the difference between mobile application and desktop application?
Differentiate between static class and singleton instance?
State whether it is true to test a Web service you must create a windows application or Web application to consume this service or not?