大家帮忙看看,为什么我的程序老是出现Overflow错误,run time error'6'
然后停在程序以下红色语句的地方
Private Sub btnDownload_Click()
Dim i As Integer
Dim Temp(0) As Byte
Dim s As String
Command1_Click
Command2_Click
'If Option1.Value = True Then
' MSComm1.CommPort = 1
'ElseIf Option2.Value = True Then
' MSComm1.CommPort = 2
'End If
MSComm1.PortOpen = True
MSComm1.Settings = "19200,O,8,1"
For i = 0 To UBound(Message) - 1
Temp(0) = Message(i)
If (i Mod 1002) = 0 Then
MSComm1.PortOpen = False
MSComm1.Settings = "19200,O,8,1"
MSComm1.PortOpen = True
MSComm1.Output = Temp
Sleep (700)
MSComm1.PortOpen = False
MSComm1.Settings = "19200,E,8,1"
MSComm1.PortOpen = True
Else
MSComm1.Output = Temp
End If
' If (i Mod 1002) = 0 Then
' Winsock1.SendData Temp
' Sleep (600)
' Else
' Winsock1.SendData Temp '发送数据
' End If
On Error GoTo err
' Winsock1.SendData Temp '发送数据
' MSComm1.Output = Temp
Next
'
MsgBox "发送成功 !", vbOKOnly
Debug.Print "OK!"
MSComm1.PortOpen = False
' For i = UBound(Message) - 1001 - 260 To UBound(Message) - 1001
' Text1.Text = s$
' Winsock1.Close
Exit Sub
err:
MsgBox "请检查屏幕是否已经正确接入网络,IP地址和端口设置是否正确", vbOKOnly
Unload Me
End Sub