vorrei imparare ad utilizzare le porte com da vb è ho creato due semplici programmini uno( per smartphone cf2.0) in grado di inviare una stringa e l'altro( per pc ) in grado di leggere una stringa.Per fare cio sto usando un programma che permette di creare com virtuali (serial splitter),usando questo programma ho creato due com virtuali,una in ingresso(com1) e l altra in uscita(com5).Il problema è ke non riesco ad inviare/ricevere niente
ecco il codice del programma per l'invio:
codice:
Public Class Form1

    Sub SendSerialData(ByVal data As String)
        SerialPort1.PortName = ComboBox1.SelectedItem.ToString
        SerialPort1.Open()
        If SerialPort1.IsOpen Then
            SerialPort1.WriteLine(data)
            MsgBox("dati inviati")
            SerialPort1.Close()
        Else
            MsgBox("porta NON APERTA")
        End If
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each sp As String In System.IO.Ports.SerialPort.GetPortNames
            ComboBox1.Items.Add(sp)
        Next
    End Sub
    Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
        Dim data As String = ""
        data = TextBox1.Text
        SendSerialData(data)
    End Sub
End Class
...e quello del programma per la ricezione:
codice:
Public Class Form1
    Function ReceiveSerialData() As String
        ' Receive strings from a serial port.
        Dim returnStr As String = ""
        SerialPort1.PortName = ListBox1.SelectedItem.ToString
        SerialPort1.Open()
        If SerialPort1.IsOpen() Then
            Do
                Dim Incoming As String = SerialPort1.ReadLine()
                If Incoming Is Nothing Then
                    Exit Do
                Else
                    returnStr = Incoming
                End If
            Loop
            Return returnStr
        Else
            MsgBox("porta non aperta")
        End If
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = ReceiveSerialData()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' Show all available COM ports.
        For Each sp As String In My.Computer.Ports.SerialPortNames
            ListBox1.Items.Add(sp)
        Next
    End Sub
End Class
come posso risolvere?