|
![](http://cache.amobbs.com/bbs_upload782111/files_48/ourdev_702487BRX9JR.JPG)
(原文件名:12.JPG)
![](http://cache.amobbs.com/bbs_upload782111/files_48/ourdev_702488PVW7OM.JPG)
设置不成功 (原文件名:13.JPG)
---------------------------------------------------------------------
代码
----------------------
Private Sub Form_Load()
aaa: Text1.Text = "0"
If Option1.Value = 1 Then
If Mscomm1.PortOpen = False Then
Mscomm1.CommPort = 1
Mscomm1.Settings = "4800,e,8,1"
Mscomm1.PortOpen = True
Mscomm1.RThreshold = 5
Text1.Text = "1"
End If
Else
End If
If Option2.Value = 1 Then
If Mscomm1.PortOpen = False Then
Mscomm1.CommPort = 2
Mscomm1.Settings = "4800,e,8,1"
Mscomm1.PortOpen = True
Mscomm1.RThreshold = 5
Text1.Text = "2"
End If
Else
End If
If Option3.Value = 1 Then
If Mscomm1.PortOpen = False Then
Mscomm1.CommPort = 3
Mscomm1.Settings = "4800,e,8,1"
Mscomm1.PortOpen = True
Mscomm1.RThreshold = 5
Text1.Text = "3"
End If
Else
End If
End Sub
---------------------------------------------------------------------
说明:
程序运行时,串口设置不成功。
代码里面的Text1.Text =是为了调试方便而加入的。
请教大家:这代码错在哪里了?如何才能设置串口成功? |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|