谢谢大家,我做两个程序,一个将COMMPORT=1
谢谢大家,我做两个程序,一个将COMMPORT=1,另一个将COMMPORT=2,然后同时打开
这两个程序,此时一个程序点击发送,另一个按接收是可以收到的,问题是我想把两个程序合成一个程序,在一个程序内发送与接收。请各位高手出出点子,两个程序代码如下:
第一个程序 FORM1
Private Sub cmdexit_Click()
MSComm1.PortOpen = False
End
End Sub
Private Sub cmdreceive_Click()
Dim buf$
buf = Trim(MSComm1.Input)
If Len(buf) = 0 Then
txtreceive.Text = Empty
Else
txtreceive.Text = buf
End If
End Sub
Private Sub cmdsend_Click()
MSComm1.Output = Trim(txtsend.Text)
End Sub
Private Sub CLS_Click()
txtsend = ""
txtreceive = ""
End Sub
Private Sub Form_Load()
MSComm1.CommPort = 2
MSComm1.PortOpen = True
End Sub
第二个程序FORM2
Private Sub cmdexit_Click()
MSComm1.PortOpen = False
End
End Sub
Private Sub cmdreceive_Click()
Dim buf$
buf = Trim(MSComm1.Input)
If Len(buf) = 0 Then
txtreceive.Text = Empty
Else
txtreceive.Text = buf
End If
End Sub
Private Sub cmdsend_Click()
MSComm1.Output = Trim(txtsend.Text)
End Sub
Private Sub CLS_Click()
txtsend = ""
txtreceive = ""
End Sub
Private Sub Form_Load()
MSComm1.CommPort = 2
MSComm1.PortOpen = True
End Sub