prabha_friend
Prabhakaran Karuppaih
- Local time
- Today, 05:24
- Joined
- Mar 22, 2009
- Messages
- 970
Code:
Imports System.IO.Ports
Imports System.IO
Public Class Scale
Private WithEvents SerialPort As New SerialPort()
Private Const COM_PORT As String = "COM5" ' Change this to your COM port
Public Sub New()
' Constructor logic here if needed
With SerialPort
.PortName = COM_PORT
.BaudRate = 9600
.ReadTimeout = 1000
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
End With
End Sub
Public Function ReadScale() As String
Dim _scaleValue As String
SerialPort.Open()
_scaleValue = SerialPort.ReadLine
SerialPort.Close()
Return _scaleValue
End Function
End Class
Code:
Public Sub mac()
dim myScale as New Scale
End Sub
I am getting "Expected Identifier" Error. What's wrong?