How to avoid GUI being blocked by button click handler?

  • Thread starter Thread starter Stan Huang at Taiwan
  • Start date Start date
S

Stan Huang at Taiwan

Guest
Below is my VC# button click handler. It's a pinging forever program. I hope the ping result can be shown in edit box at each iteration. I am sure the ping result can be shown correctly at edit box if the ping is done once, not forever. If I do ping forever, the GUI seems blocked. How can I do for it?

private void btnPingStart_Click(object sender, EventArgs e)

{
startPing = true;
for (; ; )
{
if (GwPing.startPing == true)
GwPing.pingAllGws();
System.Threading.Thread.Sleep(1000 * 1);
}
}

Continue reading...
 
Back
Top