?
Solved

Using the MSCOMM control with VB

Posted on 2003-11-25
3
Medium Priority
?
532 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

770 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