如何在不按下Mettler Toledo秤上的按钮的情况下打印重量

时间:2017-07-09 08:03:14

标签: vb.net visual-studio-2010

当我按下刻度尺上的按钮时,这是我的代码:

Private Sub SerialPort1_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
    If comOpen Then
        Try
            readBuffer = SerialPort1.ReadExisting()
            Me.Invoke(New EventHandler(AddressOf DoUpdate))
        Catch ex As Exception
            MsgBox("read " & ex.Message)
        End Try
    End If
End Sub

Public Sub DoUpdate(ByVal sender As Object, ByVal e As System.EventArgs)
    TxtIn.AppendText(readBuffer)
End Sub

我的尺度为Metller Toledo AB204-S

1 个答案:

答案 0 :(得分:0)

最后我发现了我的卡住了

Private Sub BtnSend_Click(sender As Object, e As EventArgs) Handles BtnSend.Click
    SerialPort1.WriteLine("SI" & vbCrLf)
End Sub

该代码命令SI和CrLf