Serial COM in VB 2005

C

cmdolcet69

When i send a serial command serialport.write("[exc]") o a specified
serial open serial port. How can i read back the value in a string and
display it in a textbox???
 
K

Ken Halter

cmdolcet69 said:
When i send a serial command serialport.write("[exc]") o a specified
serial open serial port. How can i read back the value in a string and
display it in a textbox???

Check the specs on the device you're working with. If it supports the
functionality, it should be easy. Otherwise forget it. Buffering the data
won't do any good either. It's entirely up to the device you're working
with.

Same as putting gas in a car and asking the car how much gas you just put
in... if the car supports that functionality, the info will be right on the
dashboard... otherwise, ain't gonna happen.
 
C

cmdolcet69

When i send a serial command serialport.write("[exc]") o a specified
serial open serial port. How can i read back the value in a string and
display it in a textbox???

Check the specs on the device you're working with. If it supports the
functionality, it should be easy. Otherwise forget it. Buffering the data
won't do any good either. It's entirely up to the device you're working
with.

Same as putting gas in a car and asking the car how much gas you just put
in... if the car supports that functionality, the info will be right on the
dashboard... otherwise, ain't gonna happen.

The device can reply with a {exc 2000} however how can i read that
from the port and then display it in a textbox.
 
D

Dick Grier

Use the Read or ReadExisting (text only) methods. You can call this from
the DataReceived event. However, if you use DataReceived, you must use a
delegate to display the data, to avoid a cross-thread violation. You also
can use a Windows forms Timer control to poll ReadExisting, with no need for
a delegate.

I have lots of code examples in my book -- see below.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top