0

我想用 VB.net 在 RS232 上接收数据命令

目前我的代码运行良好,但除非没有收到数据,否则无法使用 userForm,因为代码在 serialport.read 中不断。如何允许用户访问表单。我计划实现 DoEvent() 函数,但是如何实现呢?你有想法吗?

这是我的代码:

    Try
          readBytes = Form1.SerialPort1.Read(buffer_rx, offset, remaining)
        offset += readBytes
        remaining -= readBytes
        totalReadBytes += readBytes
Catch ex As TimeoutException
ReDim Preserve buffer_rx(totalReadBytes - 1)
End Try

谢谢,

4

0 回答 0