yvqn9945
Newbie level 4
- Joined
- Aug 19, 2013
- Messages
- 5
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 50
I have to receive a charecter sent form MCU to PC and I have to write a function to receive data in vb.net since I am a biginer in vb.net unable to code. I have googled and find the following code but this is for receiving and displaying on RichTextBox but I have to receive and assign it to a variable for further use. For which how to write a function. Please help me. Please give coding. Thank you.
Code:
Code:
Code vb.net - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Private Sub SerialPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceived ReceivedText(SerialPort.ReadExisting()) End Sub 'Serial Port Receiving Code Ends Here …. 'Serial Port Receiving Code(Invoke) Starts Here …. Private Sub ReceivedText(ByVal [text] As String) If Me.RichTextBox_rxdata.InvokeRequired Then Dim x As New SetTextCallback(AddressOf ReceivedText) Me.Invoke(x, New Object() {(text)}) Else Me.RichTextBox_rxdata.Text &= [text] End If End Sub
Last edited by a moderator: