VB.Net by API/System.IO.Ports/SerialPort

Материал из VB Эксперт
Перейти к: навигация, поиск

SerialPort.WriteLine

   
Public Class Tester
    Public Shared Sub Main
    
        Dim com1Port As IO.Ports.SerialPort = Nothing
        Try
            com1Port = My.ruputer.Ports.OpenSerialPort("COM1")
            com1Port.WriteLine("serialData")
            com1Port.Write("serialData")
            com1Port.Close()
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        Finally
            If (com1Port IsNot Nothing) Then com1Port.Dispose()
            com1Port = Nothing
        End Try
    End Sub
End Class