Adding & Use MSCOMM in visual basic 2010 express

whywhy picture whywhy · Mar 15, 2013 · Viewed 7.4k times · Source

i already add the mycomm.lib into my visual basic by clicking Project-> Add reference -> Com Tab -> choose mycomm control 6.0. But i still dunno how to use it. What i want is to send a character From visual basic express 2010 to Microcontroller.

Answer

Cody Gray picture Cody Gray · Mar 15, 2013

The MSComm Control 6.0 is intended for use with a very old version of Visual Basic (VB 6.0) that is completely incompatible with VB.NET (which is what you have now, in Visual Basic 2010). This old control is provided only for backwards compatibility and is not recommended for use in new applications.

The .NET Framework provides the System.IO.Ports.SerialPort class, which is what you should be using instead. I think you'll find it much easier to work with, since it was designed with VB.NET in mind.

You can find some very comprehensive sample code at the bottom of the above-linked documentation. And if that doesn't serve your purposes, you can surely find lots of sample code elsewhere online now that you know the magic term to unlock the oracle of Google.