private void button2_Click(object sender, EventArgs e) { isClose = true; try { int isSuccess = CVRSDK.CVR_CloseComm(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (!isClose) { try { CVRSDK.CVR_CloseComm(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }