If you are a beginner, the tutorial may seem quite overwhelming to you, but just take it easy step by step. The tutorial also includes a small sample program. I have written a very big SerialPort tutorial, which may be helpful to you. Open the port when you establish communication with your device (typical when you select the COM port) and don't close it again until you change the COM port or terminate your application. You also make the very common mistake to open and close the port all the time. You write "Successfully Connected!" even though it may not be the case? If you want to test for this, open the port in a Try statement and catch any exceptions. It also gives you a better overview of your program. I usually recommend to make your own SerialPort declaration. It may work, but I know that somebody had problems with this. Since you have no SerialPort declaration, I presume that you have just dragged the SerialPort object onto your form from the toolbox.
0 Comments
Leave a Reply. |