dim transfile(100) '要传送的数据
'传送数据,主要用于下载程序
Private Sub Command4_Click()
'Dim trans
Command5.Enabled = False
With MSComm1
If Combo1.Text = "" Then
MsgBox "请选择端口号!"
Exit Sub
End If
If Combo2.Text = "" Then
MsgBox "请选择传输速度!"
Exit Sub
End If
If Combo1.Text = "com1" Then
.CommPort = 1 '使用COM2
End If
If Combo1.Text = "com2" Then
.CommPort = 2
End If
If Combo2.Text = "9600" Then
.Settings = "9600,N,8,1" '设置通信口参数
End If
If Combo2.Text = "4800" Then
.Settings = "4800,n,8,1"
End If
.OutBufferSize = 1024 '设置MSComm1发送缓冲区为2字节
.SThreshold = 1 '设置Output 一次从发送缓冲读取字节数为1
.OutBufferCount = 0 '清除发送缓冲区
If .PortOpen = False Then '判断通信口是否打开
.PortOpen = True '打开通信口
If Err Then '错误处理
MsgBox "串口通信无效"
Exit Sub
End If
End If
End With
MSComm1.Output = transfile
End Sub为什末出错,错误为:output 属性值无效
'传送数据,主要用于下载程序
Private Sub Command4_Click()
'Dim trans
Command5.Enabled = False
With MSComm1
If Combo1.Text = "" Then
MsgBox "请选择端口号!"
Exit Sub
End If
If Combo2.Text = "" Then
MsgBox "请选择传输速度!"
Exit Sub
End If
If Combo1.Text = "com1" Then
.CommPort = 1 '使用COM2
End If
If Combo1.Text = "com2" Then
.CommPort = 2
End If
If Combo2.Text = "9600" Then
.Settings = "9600,N,8,1" '设置通信口参数
End If
If Combo2.Text = "4800" Then
.Settings = "4800,n,8,1"
End If
.OutBufferSize = 1024 '设置MSComm1发送缓冲区为2字节
.SThreshold = 1 '设置Output 一次从发送缓冲读取字节数为1
.OutBufferCount = 0 '清除发送缓冲区
If .PortOpen = False Then '判断通信口是否打开
.PortOpen = True '打开通信口
If Err Then '错误处理
MsgBox "串口通信无效"
Exit Sub
End If
End If
End With
MSComm1.Output = transfile
End Sub为什末出错,错误为:output 属性值无效
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货