注册 登录
编程论坛 VB6论坛

我设置的com口怎么不起作用呢?

wxl900306 发布于 2013-03-07 10:47, 330 次点击
我用combobox控件做的com口选择,但无论选择那个com口都可以正常运行(串口线连接的是com1口),那位能帮我看一下!谢了
程序代码:
Private Sub Combo1_Change()           '下拉菜单,选择COM口
Dim COM As String
If Combo1.Text = "COM1" Then
COM = 1
ElseIf Combo1.Text = "COM2" Then
COM = 2
'ElseIf Combo1.Text = "COM3" Then
'
= "COM3"
'
ElseIf Combo1.Text = "COM4" Then
'
= "COM4"
'
ElseIf Combo1.Text = "COM5" Then
'
= "COM5"
'
ElseIf Combo1.Text = "COM6" Then
'
= "COM6"
'
ElseIf Combo1.Text = "COM7" Then
'
= "COM7"
'
ElseIf Combo1.Text = "COM8" Then
'
= "COM8"
'
ElseIf Combo1.Text = "COM9" Then
'
= "COM9"
Else
End If
If MSComm1.PortOpen = True Then
    = COM
    End If
   
End Sub

2 回复
#2
Artless2013-03-07 12:25
Combo1_Click
#3
wangyuzg2013-03-07 14:18
没看懂你说的什么?你要求的是什么。
1