Visual Studio SerialPort

时间:2017-02-22 01:23:05

标签: c# vb.net serial-port vb.net-2010

我从windows c#

获得了这段代码
  private void frmMain_Load(object sender, EventArgs e)
   {
        serialPort1.Open();
        if (serialPort1.IsOpen)
        {
            this.serialPort1.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.serialPort1_DataReceived);
        }
    }

我正在使用 Converter 将其转换为Windows表单代码。

转换后我得到了这段代码

Private Sub frmMain_Load(sender As Object, e As EventArgs)
serialPort1.Open()
If serialPort1.IsOpen Then
    Me.serialPort1.DataReceived += New System.IO.Ports.SerialDataReceivedEventHandler(Me.serialPort1_DataReceived)
End If
End Sub

但我在Me.serialPort1.DataReceived中遇到问题,请参阅下面的图片

enter image description here

0 个答案:

没有答案