Hi!
I'm using Rs232-class, which was shipped with 101 VB.NET samples by
Microsoft. Application is made to read COM-port with the following code...
Try
Me.tmrReadCommPort.Enabled = True
If (Not m_CommPort.IsOpen) Then m_CommPort.Open()
Dim strCommand As String =
ConfigurationSettings.AppSettings("ReadCommand")
m_CommPort.Write(Encoding.ASCII.GetBytes(strComman d + vbCrLf))
Threading.Thread.Sleep(60)
Application.DoEvents()
Catch ex As Exception
MessageBox.Show("Unable to communicate with the COM-port", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
Me.tmrReadCommPort.Enabled = False
If (m_CommPort.IsOpen) Then m_CommPort.Close()
End Try
.... it's working almost fine. Problem is line "Application.DoEvents()"
because looks like sometimes code execution is not continuing after that
line, and "tmrReadCommPort" is not updating textbox which is for showing
readed data from COM-port. If "Application.DoEvents" line is removed, then
textbox (which is for showing readed data from COM-port) is newer updated.
Any ideas what to try next?
--
Thanks in advance!
Mika