How do I known when I get a value from a serial port and get it?  
Author Message
Tolis Carpenter





PostPosted: Common Language Runtime, How do I known when I get a value from a serial port and get it? Top

I develop an application with visual basic .net 2003 and my problem is that my program it has to known when a weighing machine gives the weight value from a serial port and read it.

I will be grateful if someone can help me.

 



.NET Development21  
 
 
Ryan Byington





PostPosted: Common Language Runtime, How do I known when I get a value from a serial port and get it? Top

There are a couple of things you can do here but by far the easiest is to use the DataReceived event on the SerialPort class. See http://msdn2.microsoft.com/ms143556(en-US,VS.80).aspx for more information. This event works with the ReceivedBytesThreshold property that defines how many bytes the SerialPort must contain before this event is fired. See http://msdn2.microsoft.com/system.io.ports.serialport.receivedbytesthreshold.aspx for more information.

So you can just sign up for this event and perform the read inside the event handler.

Hope this helps or at least points you in the right direction.

Ryan Byington [MS]



 
 
Tibor19





PostPosted: Common Language Runtime, How do I known when I get a value from a serial port and get it? Top

Ryan,

You are missing the point. He said VB.NET 2003, and SerialPort is part of 2005. So there are 2 solution 1. Update to 2005. 2. Write your own class to handle serial port with help of PInvoke. There is some available source on the net for that...



 
 
CsOtto





PostPosted: Common Language Runtime, How do I known when I get a value from a serial port and get it? Top

I don't know maybe you have fix that problem I have solved that kind of a problem.I had a WE2110 or something like this I dont remember exactly. If you need I could help you