private void btnExit_Click(object sender, EventArgs e) { if (thsend != null) { thsend.Abort(); thsend = null; } tc = null; this.Close(); }
private void btnStop_Click(object sender, EventArgs e) { btnStop.Enabled = false; if (thsend != null) { thsend.Abort(); thsend = null; } tc = null; btnSend.Enabled = true; }
private void btnSend_Click(object sender, EventArgs e) { listBox1.Items.Clear(); int startNum, stopNum, minNum; startNum = Num.IntParse(comboBox1.Text); stopNum = Num.IntParse(comboBox2.Text); if (stopNum < startNum) { minNum = startNum; startNum = stopNum; stopNum = minNum; } btnSend.Enabled = false; tc = new tempClass(startNum, stopNum); tc.st = new sendText(SendTextToMcgs); thsend = new Thread(new ThreadStart(tc.SendStrToMcgs)); thsend.IsBackground = true; thsend.Start(); btnStop.Enabled = true; }