Private Sub MSComml_OnComm()
Dim buffer As Variant '由缓冲区接收到的数据用Variant格式接收
Dim arr()As Byte '定义二进制数组
Dim i As Integer
Dim receivester As string '定义输出到接收文本框中的字符变量
'下段程序是comEvReceive事件触发后,将数据存入相应的数组,并在接收文本框中显示
Select Case MSComml.CommEvent CasecomEvReceive buffer="MSComml".Inpute
arr=buffer接收缓冲区内数据variant变量内
arr=buffer '转换为二进制数并送入相应数组
For i="1to8"
receivester arr(i)
Text1.Text=Text1.Text&receiverstr&"."
'在接收框中显示文本
Next i
End Select
End Sub