Hi,
I'm experimenting with the Serial Port in VB.NET 2005. Although it isn't
that easy to get any feedback from my COM-port as I thought it would be...
How can I read all the Data that the port sends back?
I tryed with SerialPort1.ReadLine, but that blocks the application and takes
a lot of time (10 seconds!), I tryed SerialPort1.Read, but I have to read it
into a buffer and has to indicate the count, but how do I know this?
Does anybody knows a nice way to send and receive smoothly all the data from
the SerialPort?
Thanks a lot in advance,
Pieter 6 16969
Have you looked at Microsoft comm control activeX. It makes it real easy to
communicate to the serial port. Once you are connected you set the output
property to what you are sending and then the input property contains what
has been sent back.
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:O6**************@TK2MSFTNGP09.phx.gbl... Hi,
I'm experimenting with the Serial Port in VB.NET 2005. Although it isn't that easy to get any feedback from my COM-port as I thought it would be...
How can I read all the Data that the port sends back?
I tryed with SerialPort1.ReadLine, but that blocks the application and takes a lot of time (10 seconds!), I tryed SerialPort1.Read, but I have to read it into a buffer and has to indicate the count, but how do I know this?
Does anybody knows a nice way to send and receive smoothly all the data from the SerialPort?
Thanks a lot in advance,
Pieter
Altman,
VS.NET 2005 has a managed SerialPort class (aka comm), no need for an
activeX control. http://msdn2.microsoft.com/library/30swa673.aspx
The new SerialPort class appears to be even easier then the old activeX comm
control! At the very least you are NOT dealing with COM interop!
Unfortunately I have not used it much yet to answer DraguVaso's question.
Hope this helps
Jay
"Altman" <No******@SickOfSpam.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl... Have you looked at Microsoft comm control activeX. It makes it real easy to communicate to the serial port. Once you are connected you set the output property to what you are sending and then the input property contains what has been sent back. "DraguVaso" <pi**********@hotmail.com> wrote in message news:O6**************@TK2MSFTNGP09.phx.gbl... Hi,
I'm experimenting with the Serial Port in VB.NET 2005. Although it isn't that easy to get any feedback from my COM-port as I thought it would be...
How can I read all the Data that the port sends back?
I tryed with SerialPort1.ReadLine, but that blocks the application and takes a lot of time (10 seconds!), I tryed SerialPort1.Read, but I have to read it into a buffer and has to indicate the count, but how do I know this?
Does anybody knows a nice way to send and receive smoothly all the data from the SerialPort?
Thanks a lot in advance,
Pieter
DraguVaso,
I have not tried the new SerialPort yet, are you using it from your
MainWindow (thread) or in a separate thread?
Looking at http://msdn2.microsoft.com/library/30swa673.aspx
Have you tried handling the ReceivedEvent?
I would probably use a separate thread...
Again I have not really tried got a chance to play with it.
If you haven't you may want to ask in the VS.NET 2005 newsgroups found at: http://communities.microsoft.com/new...y&slcid=us
The bottom of the intro has instructions on how to use the newsgroups via
Outlook Express instead of the web interface.
Hope this helps
Jay
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:O6**************@TK2MSFTNGP09.phx.gbl... Hi,
I'm experimenting with the Serial Port in VB.NET 2005. Although it isn't that easy to get any feedback from my COM-port as I thought it would be...
How can I read all the Data that the port sends back?
I tryed with SerialPort1.ReadLine, but that blocks the application and takes a lot of time (10 seconds!), I tryed SerialPort1.Read, but I have to read it into a buffer and has to indicate the count, but how do I know this?
Does anybody knows a nice way to send and receive smoothly all the data from the SerialPort?
Thanks a lot in advance,
Pieter
Hi,
You can read all AVAILABLE data. You should read data as it is acquired and
buffered.
What I do is to use the OnComm receive event. I double-buffer data there
(append to a variable) until all of the data that I need has been received.
I do this by parsing (in you case, append to a string buffer, and use the
IndexOf method of the string to locate the appropriate terminating
condition), or by checking the length of the data that have been buffered.
BTW, I have examples of these sorts of things in my book (see below),
including VS 2005.
Dick
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004.
Thanks for the info!
did you also use an SMS-Modem? Especially the Audiotel Industrial GPRS plus
Modem?
"Dick Grier" <di**************@msn.com> wrote in message
news:e%****************@TK2MSFTNGP14.phx.gbl... Hi,
You can read all AVAILABLE data. You should read data as it is acquired
and buffered.
What I do is to use the OnComm receive event. I double-buffer data there (append to a variable) until all of the data that I need has been
received. I do this by parsing (in you case, append to a string buffer, and use the IndexOf method of the string to locate the appropriate terminating condition), or by checking the length of the data that have been buffered.
BTW, I have examples of these sorts of things in my book (see below), including VS 2005.
Dick
-- Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 4th Edition ISBN 1-890422-28-2 (391 pages) published July 2004.
Hi,
I have not used an SMS modem. It shouldn't matter, though. Modems are
modems... There are individual small variations (and "funnies"), but in
general they work similarly.
Dick
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: DraguVaso |
last post by:
Hi,
I'm experimenting with the Serial Port in VB.NET 2005. Although it isn't
that easy to get any feedback from my COM-port as I thought it would be...
How can I read all the Data that the...
|
by: Don Tucker |
last post by:
Hello, I am using Visual Studio .Net 2005 beta. I have my computer's two
comm ports connected with a serial cable (and null modem). I'm trying to
write the letter 'a' out on comm port 1 with the...
|
by: Tolgay Gül |
last post by:
I need some codes that able to send and read data by serialport in VB.Net
2005 beta 2. I wrote some codes and It can send data via serialport but It
cannot read what I send. I have looked up on...
|
by: pandi |
last post by:
Hi,
I am using a check scanner.It has functions which gives output like image ,checknumber. i am using serial port to get this output in my coding. My problem is i am not able to read the display...
|
by: Jean Paul Mertens |
last post by:
Hello,
Someone can tell me why I dont get serial port events in a Service, I
created a separate Thread to open the port but no events are coming up (the
same happens when I use the timer...
|
by: chenatcr |
last post by:
Hello,
I added a serial-USB converter to my laptop, it appear as USB serial
port COM4, and I wrote an application to read 78k data from this port.
In my VC++ express code, I defined...
|
by: Adriano |
last post by:
Hello,
I'm developing an application in VB.NET 2005 that communicates with a device
through RS232,
and need to send the following sequence of hexadecimal data to the device:
0xFF, 0x01, 0xC3,...
|
by: qwer |
last post by:
hi
im actually doing on a SMS application using Visual Basic.Net whereby the objective is to allow the user to send a SMS to the visual basic programme and i should decode out the hp no, car plate,...
|
by: cmdolcet69 |
last post by:
Im trying to raed data over a com port. The data comes over the serial
port as such reading CRLF reading CRLF and so on.
The code below only sees the first reading CRLF and then only added
that...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |