M
<p>i'm doing a project in VB where i'm using comm port but when i try to open the port it gives the error as port already open though the port is not open.
<p>my source code is as follows:
<pre>
Private Sub Form_Load()
Dim str As String
MSComm1.CommPort = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
Text1.Text = "sending: hello"
MSComm1.Output = "hello"
Do
DoEvents
Loop Until MSComm1.InBufferCount = 0
str = MSComm1.Input
Text1.Text = "recived:" + str
MsgBox "recieved" + str
MSComm1.PortOpen = False
End Sub
</pre>
<p>my source code is as follows:
<pre>
Private Sub Form_Load()
Dim str As String
MSComm1.CommPort = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
Text1.Text = "sending: hello"
MSComm1.Output = "hello"
Do
DoEvents
Loop Until MSComm1.InBufferCount = 0
str = MSComm1.Input
Text1.Text = "recived:" + str
MsgBox "recieved" + str
MSComm1.PortOpen = False
End Sub
</pre>