Hello guys,
As my title implies i have the following problem, i am receiving data from serial port and i update a richtextbox in a MDI Form with the control.invoke method
(Code in SerialPort.DataReceived Event)
But as a mdi form it has the ability to close and reopen. So when the serialport is sending data to richtextbox and the user click the close button and the form gets disposed. Then the error "Invoke or BeginInvoke cannot be called on a control until the window handle has been created."... Any Idea????Code:If myTerminal.Visible Then myTerminal.MyRichTextBox1.Invoke(New MethodInvoker(Sub() myTerminal.MyRichTextBox1.AppendText(dataLine & vbCrLf) End Sub)) End If
My regards,
Ribben


Reply With Quote