I have to receive a Character 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. Thank you.Coderivate 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