On Error Resume Next
MSComm1.PortOpen = True
MSComm1.Output = Chr$(27) & Chr$(61) & Chr$(2) 'MSComm1.Output = "**"
MSComm1.Output = Chr$(12) '清屏
MSComm1.Output = "您好,欢迎光临" & Chr$(10) & vbCr
MSComm1.PortOpen = False
If Err.Number <> 0 Then
n = MsgBox(" 开启出错,请检查端口")
Err.Clear
End If
刚接触vb,想问一下第一行以及最后的错误码判断在c#怎么写
------解决思路----------------------
try
{
MSComm1.PortOpen = True
MSComm1.Output = Chr$(27) & Chr$(61) & Chr$(2) 'MSComm1.Output = "**"
MSComm1.Output = Chr$(12) '清屏
MSComm1.Output = "您好,欢迎光临" & Chr$(10) & vbCr
MSComm1.PortOpen = False
}
catch(Exception ex)
{
n = MsgBox(" 开启出错,请检查端口")
}