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


Please Help Members By Posting Answers For Below Questions

What are the types of inheritance in c#?

491


Is it possible to nest cfml conditional tags?

534


What is sqlconnection in c#?

484


Can you store strings in arrays?

535


How do I start a program in c#?

486






What is a thread? What is multithreading?

499


how to compare numbers and dispaly the largest ? *first thing I wanted to do is to input how many numbers to be compared *and then analyzed the largest then display it.

1278


What is a class c#?

469


Define strong name in c#?

511


Why static variables are used?

510


what is scope of a protected internal member variable of a c# class

528


What is the use of getcommandlineargs() method in c#.net?

501


What are c# i/o classes? What are the commonly used i/o classes?

507


What is data type c#?

486


What is xamarin used for?

504