diff options
| -rw-r--r-- | Pinger/Pinger/Form1.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Pinger/Pinger/Form1.cs b/Pinger/Pinger/Form1.cs index 5b4e89b..bf15a8a 100644 --- a/Pinger/Pinger/Form1.cs +++ b/Pinger/Pinger/Form1.cs @@ -12,11 +12,13 @@ using System.Windows.Forms; namespace Pinger { public partial class myNetForm : Form { + private Thread t; + public myNetForm() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; - Thread t = new Thread(PingStatus); + t = new Thread(PingStatus); t.Start(); } @@ -24,7 +26,7 @@ namespace Pinger { Ping p = new Ping(); PingReply pr; - while(true) { + while(!this.IsDisposed) { lblNotifyPingEvent.Visible = true; try { pr = p.Send(cbPingAddress.Text); |
