'vb.net weighbridge scale com port reading live
I have to read my weighbridge scale value to system ,I have created vb.net file for this and getting reading .but I need live reading and if com port is not detected just get message popup instead of error .Thanks advance for your advice.
Imports System. Text
Imports System.IO.Ports
Imports System.Windows.Forms
Imports System. Threading
Imports System. Timers
Imports System.IO
Imports System. Text. RegularExpressions
Imports System. Xml
Imports System. Data
Public Class Form2
Private Sub BtnConnect_Click(sender As Object, e As Eventers) Handles BtnConnect_Click
txtData.Text = ""
serialport1 = New Serial Port
serialport1.PortName = "COM6"
serialport1.Open()
serialport1.BaudRate = 9600
serialport1.Parity = Parity. None
serialport1.DataBits = 8
serialport1.StopBits = StopBits.One
serialport1.DtrEnable = True
serialport1.RtsEnable = True
serialport1.Handshake = IO.Ports.Handshake.None
serialport1.ReceivedBytesThreshold = 1
txtData.Text = Extract Numbers(serialport1.ReadExisting())
serialport1.Close()
If serialport1.IsOpen = False Then
MsgBox("not")
Exit Sub
End If
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
