private void frmTimekeeping_FormClosed(object sender, FormClosedEventArgs e) { try { serialPortManager.CloseConnection(); } catch { //No problem } }
private void comboBoxOutputDevice_SelectedIndexChanged(object sender, EventArgs e) { try { // try to close if it has opened a connection before serialPortManager.CloseConnection(); } catch (Exception ex) { //Noproblem ^^ } //serialPortManager = new SerialPortConn(comboBoxOutputDevice.Text); serialPortManager.OpenConnection(); }