Welcome to MSDN Blogs Sign in | Join | Help

Syndication

Using the Serial and USB ports with VB.NET

I was playing around with my USB GPS receiver the other day and started to wonder how hard it would be to integrate it into my applications (more on this in the future).  The first challenge I had was to be able to talk with it via the USB port and gather the location data.

It was a late at night and my mind was not functioning at 100%, or even 25%.  So I want out to Google MSN Search to find some code examples of talking to USB devices with VB.NET and there was next to nothing in the world.

It was only after a few minutes that my brain caught up and it hit me that the S in USB was for serial.  A simple fact and the fact that it took me a matter of minutes to wake up to this should have caused me to head to bed and get some sleep but no such luck.

Moral of my story, if you are looking at talking with either a Serial port or a USB device you can access it with some of the code from this sample.

It is an older sample but works great.  Saves you the pain of having to interact with or wrap the Win32 APIs for serial access yourself.

 

Published Thursday, April 07, 2005 12:05 PM by Brad_McCabe

Comments

# re: Using the Serial and USB ports with VB.NET @ Thursday, April 07, 2005 10:25 PM

check this out...
http://www.icsharpcode.net/opensource/sharpusblib/

nat

# re: Using the Serial and USB ports with VB.NET @ Friday, April 08, 2005 11:12 AM

One bit of clarification. Not every USB device can speak the RS-232 lanaguage. In other words your USB hard drive is most likely not going to answer and respond to commands as a COM port.

Brad_McCabe

# re: Using the Serial and USB ports with VB.NET @ Monday, April 11, 2005 10:18 AM

In the sample code you provided, how do you configure it to use a USB port? Normally you have com1, com2 etc... How would I talk to say, USB device 3 via com?

Thanks,
Russ

Russ

New Comments to this post are disabled
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement  
Page view tracker