Solved

Using the MSCOMM control with VB

Posted on 2003-11-25
3
519 Views
Last Modified: 2010-05-03
Hi

I'm working with a handheld device at present that has a serial connection to enable the download of information from the device to a PC.  Having programmed the device to send the data that is collected, I'm not looking at the PC app to collect that data.

I have used HyperTerminal for a basic check to ensure some data is being passed from the device through the COM port to the PC and everything 'looks' ok there.

My problem is that when I try to use the MSCOMM control, for some reason as data is sent from the device, it doesn't seem to raise an onComm event and therefore I'm unable to effectively grab the data.  If is have a loop just waiting for MSComm1.Input, I get some data back.

What am I doing wrong?  Any ideas?

Regards
Simon.
0
Comment
Question by:sbennetts
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 125 total points
ID: 9817054
Hi sbennetts,

The most likely reason is that you have not set the .RTHreshold property of the mscomm control. This governs when the OnComm event is fired. By default it is zero which means you have to poll it for information. If you set it to 1 or higher then the OnComm event will be fired when there are this number of bytes in the inbuffer.

Tim Cottee MCSD, MCDBA, CPIM
Brainbench MVP for Visual Basic
http://www.brainbench.com
0
 
LVL 2

Author Comment

by:sbennetts
ID: 9817072
Your a star!  Thanks, presumably if I'm reading 'records' of 24 bytes, I can set it to 24 so that it grabs a 24 byte buffer for me.  Thanks for the quick response.
Simon.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 9817101
sbennetts

Indeed that is correct, it should then fire when you have a full 24 byte bunch of data.

Tim.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now