Hi,

I am new to programming and have attached my code so far, i need to insert the code to read data from serial port but havent a clue where to put it or how any help would be great

Imports System
Imports System.IO.Ports

Public Class Form1

    Private mySerialPort As New SerialPort

    Private Sub ButtonShowPorts_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonShowPortsol.Click
        ' Show all available COM ports. 
        For Each sp As String In My.Computer.Ports.SerialPortNames
            ListBox1.Items.Add(sp)
        Next
    End Sub

    Private Sub ButtonClearList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonClearList.Click
        ListBox1.Items.Clear()
    End Sub

    Private Sub ButtonClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonClose.Click
        Close()
    End Sub

    Private Sub ButtonRunLogger_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRunLogger.Click

    End Sub

    Private Sub ButtonStopLogger_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonStopLogger.Click

    End Sub

End Class

You could place the code from the example in the form load event and leave out th console.WriteLines.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.