|
-
Aug 8th, 2012, 11:51 AM
#1
Thread Starter
New Member
calling a different procudre in main thread from within the DataReceived procedure
Hi want to call the method HANDLEINPUT(BYVAL m_strInBuff) from the data received event.
Please help.
My code is:
Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
Try
If SerialPort1.BytesToRead >= 4 Then
SerialPort1.ReadTimeout = 1000
m_strInBuff = (SerialPort1.ReadTo(Chr(13)))
'Show_Error("m_strInBuff = " & SerialPort1.ReadExisting)
End If
'data to UI thread
'Me.Invoke(New EventHandler(AddressOf DoUpdate)) '//Commented oujt for test only
Me.Invoke(New EventHandler(AddressOf HandleInput(m_strInBuff)))
Catch ex As Exception
MsgBox("read " & ex.Message)
End Try
'End If
End Sub
Please help how I can I modify the code here
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|