Question [VB 2010] Serial port problem

softhard

Active member
Joined
Sep 29, 2012
Messages
35
Programming Experience
Beginner
Hello,
I have been debugging VB code which had written to commnunicate with serial device. My wish is to open the COM port once at the beginning of the program(must list the only using COM port) and let do the data transmissions and receptions in an infinite loop and at last close the open port.


I have a dll file where everything is written in form of functions, routines, structures and enumerations. I use this dll file in my current program. To open the COM port, every thing is written in the dll as one routine and it called at the starting of the program. The problem that i have now is, it is not listing the using COM port at first time when i run this code(listing as "No Local WPG"). But, it is listing after the second run continiously at this block of code.

IfSerial.KommPort.IsOpen Then
ComboBox1.Items.Add("Local WPG (" & Serial.KommPort.PortName & ")")
Else
ComboBox1.Items.Add("No Local WPG")
End If


I came to know this when i used timer to to run this block of code for several times. Any ideas why it is not listing the COM port at first time.

Thank you.
 
Back
Top