Port.Writeline using VB 2008 express

VB2008 Express , VB 2008.net , VB 2008 Peterborough, United Kingdom
  • 11 years ago

    I trying to send a string to a Quasar relay kit #3108v3 using the code below. The com port is opening ok yet I can trigger a relay? Help its so easy in qbasic a simple print command.

     Imports System
    Imports System.IO.Ports
    Namespace Shauntrapmatic.test
        Public Class shauntest
            Public Shared Sub Main()
                Console.WriteLine("Available Ports on this computer:")
                For Each portname As String In SerialPort.GetPortNames
                    Console.WriteLine("PORT: " & portname)
                Dim testport As String = SerialPort.GetPortNames(0)
                Using port As New SerialPort(testport)
                    port.BaudRate = 9600
                    port.DataBits = 8
                    port.Parity = Parity.None
                    port.StopBits = StopBits.One
                    'Write a string
                    Console.WriteLine("Wrote to the {0} port ", testport)
                End Using
                Console.WriteLine("Main method complete. Press Enter ")
            End Sub
        End Class
    End Namespace

    N1 being the relay's command to turn on relay 1

    What am I doing wrong?????

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer Science is no more about computers than astronomy is about telescopes.” - E. W. Dijkstra