EDN Admin
Well-known member
I am using the following code which is used to display the recvd data in the richtext box. Now when i try to close the com port while using the Read Exsisiting or Read Line the applications gets Hang and an error is thrown saying that comm port is already closed and it comes from the delegate that is used to display the text in the rich text box . <br/> please suggest the solution .
<pre lang="x-c# _displayWindow.BeginInvoke(new EventHandler(delegate
{
_displayWindow.SelectedText = string.Empty;
_displayWindow.SelectionFont = new Font(_displayWindow.SelectionFont, FontStyle.Bold);
_displayWindow.SelectionColor = MessageColor[(int)type];
_displayWindow.AppendText(msg);
_displayWindow.ScrollToCaret();
}));[/code]
View the full article
<pre lang="x-c# _displayWindow.BeginInvoke(new EventHandler(delegate
{
_displayWindow.SelectedText = string.Empty;
_displayWindow.SelectionFont = new Font(_displayWindow.SelectionFont, FontStyle.Bold);
_displayWindow.SelectionColor = MessageColor[(int)type];
_displayWindow.AppendText(msg);
_displayWindow.ScrollToCaret();
}));[/code]
View the full article