Hi mackrackit,

Sorry for the late reply.

Are you DIMing the VB input as a string as shown here. "Dim recepcao As String"
Well I tried to. The problem is with the posted program as I see it, is that it's not actually outputting any data to a Textbox or Listbox which is what I need to do .Also with VB 2008 you have to use INVOKE or an INVOKER to make a cross thread call else you incur an error(I think).

Here are my two programs. One from the other thread below (Which doesn't receive data):

Code:
Public Class Form1
    Dim WithEvents SerialPort1 As New IO.Ports.SerialPort
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        SerialPort1.PortName = "COM1"
        SerialPort1.Parity = IO.Ports.Parity.None
        SerialPort1.BaudRate = 2400
        SerialPort1.DataBits = 8
        SerialPort1.StopBits = 1
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If SerialPort1.IsOpen = False Then SerialPort1.Open()
        If SerialPort1.IsOpen = True Then MsgBox("com1 port opened sucessfully")
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If SerialPort1.IsOpen = True Then SerialPort1.Close()
        If SerialPort1.IsOpen = False Then MsgBox("com1 port closed sucessfully")

    End Sub

    Private Sub DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
        Dim recepcao As String

        recepcao = SerialPort1.ReadExisting



    End Sub


    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        SerialPort1.Write(ListBox1.Text)
The other using INVOKE which nearly works, it stacks the incoming data vertically (as previously discussed) but it does receive data from the PIC:

Code:
Imports System
Imports System.ComponentModel
Imports System.Threading
Imports System.Windows.Forms


Public Class Form1


    'Buffer for receievd data***

    Private Delegate Sub AddListBoxItemInvoker(ByVal item As Object)


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SerialPort1.PortName = "COM1"
        SerialPort1.Parity = IO.Ports.Parity.None
        SerialPort1.BaudRate = 2400
        SerialPort1.DataBits = 8
        SerialPort1.StopBits = 1

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If SerialPort1.IsOpen = False Then SerialPort1.Open()
        If SerialPort1.IsOpen = True Then MsgBox("com1 port opened sucessfully")

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If SerialPort1.IsOpen = True Then SerialPort1.Close()

        If SerialPort1.IsOpen = False Then MsgBox("com1 port closed sucessfully")

    End Sub

    

    Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived

        Me.AddListBoxItem(SerialPort1.ReadExisting)


    End Sub

    Private Sub AddListBoxItem(ByVal item As Object)

        If Me.ListBox1.InvokeRequired Then
            'We are on a secondary thread so delegation is required.
            Me.ListBox1.Invoke(New AddListBoxItemInvoker(AddressOf AddListBoxItem), (item))

        Else
            'We are on the primary thread so add the item.
            Me.ListBox1.Items.Add(item)
        End If
    End Sub
End Class
Any ideas? Or maybe a passing VB'er might have the answer.

Should I post this over on the other thread do you think?


Dave