Closing a form issue
-
Hi all, I have a form that when loaded begins to write to a serial port. On closing the form, the serial port is closed. When I click the "X" button to close the form, the form stays open, but the data from the serial port discontinues. However, to get the form to actually close, it will not do so until I right click the form's pane in the taskbar. Not sure why this would be happening....
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (_serialPort.IsOpen) _serialPort.Close();}
-
Hi all, I have a form that when loaded begins to write to a serial port. On closing the form, the serial port is closed. When I click the "X" button to close the form, the form stays open, but the data from the serial port discontinues. However, to get the form to actually close, it will not do so until I right click the form's pane in the taskbar. Not sure why this would be happening....
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (_serialPort.IsOpen) _serialPort.Close();}
Set a breakpoint on the
if
and debug. -
Hi all, I have a form that when loaded begins to write to a serial port. On closing the form, the serial port is closed. When I click the "X" button to close the form, the form stays open, but the data from the serial port discontinues. However, to get the form to actually close, it will not do so until I right click the form's pane in the taskbar. Not sure why this would be happening....
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (_serialPort.IsOpen) _serialPort.Close();}