m = Combo2.text
n = Combo3.text
u = Combo4.text
v = Combo5.text

解决方案 »

  1.   

    同意 lily0000000(黑百合) 
    Private Sub Command1_Click()
    Dim str As String
    Dim m As String
    Dim n As String
    Dim u As String
    Dim v As String
    Dim t As String
    Combo1.ListIndex = 1
    Combo2.ListIndex = 5
    Combo3.ListIndex = 2
    Combo4.ListIndex = 3
    Combo5.ListIndex = 1
    Combo6.ListIndex = 0
    m = Combo2.Text
    n = Combo3.Text
    u = Combo4.Text
    v = Combo5.Text
    Command1.Enabled = False
    Command2.Enabled = True
    Command3.Enabled = True
    str = m + "," + n + "," + u + "," + v
    Form1.MSComm1.Settings = str '"9600,N,8,1"
    End Sub
      

  2.   

    将Form1.MSComm1.Settings=str 做些例外处理
    比如:
       On Error Resume Next
       With Form1.MSComm1
            If .PortOpen Then .PortOpen=False
            .Commport=....
            .Settings=...
            
            .......
            
            .PortOpen=Ture
            If Err.Number<>0 then '表示打开串口出错
                MsgBox "打开串口出错"
            End If           
       End With
      

  3.   

    同意 lily0000000(黑百合)!!
    同意 xxlroad(土八路) !!