private void buttonStop_Click(object sender, EventArgs e) { try { formBaseDataTable.savePreviousData(int.Parse(textBoxTotalRegister.Text.ToString()), int.Parse(textBoxStartAdress.Text.ToString()) - 1); groupBoxInput.Enabled = true; if (connectForm._connectType.Equals("TCP")) { tcpclient.stopTransfer(); } else { serialDataTable.StopTransfer(); } if (_functionCode.Equals("01") || _functionCode.Equals("02")) { groupBoxDatatype.Enabled = false; groupBoxFormat.Enabled = false; } else { groupBoxDatatype.Enabled = true; groupBoxFormat.Enabled = true; } groupBoxMasterIdDelay.Enabled = true; buttonStart.Enabled = true; buttonStop.Enabled = false; buttonDisconnect.Enabled = true; } catch (Exception ae) { MessageBox.Show(ae.Message); } }