书上估计是用的定时器接收,窗体上拖MSComm1,Timer1,Text1控件各一个,并在属性设置好MSComm1的波特率,串口号,起始位,停止位等信息
Dim str_dispaly As String '定义回显字符
Private Sub Form_Load()
Me.MSComm1.PortOpen = True
Me.Timer1.Interval = 100 '定时器时间间隔
Me.Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If MSComm1.InBufferCount > 0 Then
str_dispaly = str_dispaly & MSComm1.Input
Me.Text1.Text = str_display
End If
End Sub
timer..???