Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

listening to comm port

Status
Not open for further replies.

99mel

Programmer
Oct 18, 1999
379
GB
I made a one liner program with the following code:

mscomm1.input myvariable


I have a magentic strip reader and need to get the cards details when ever it is swiped.

Is the above line alright to use as it is? Do i need to add anything else to do with timeouts, certain conditions etc?
 
probably a silly question but is that ALL the code you have, if so you may want to check out "mscomm control" in MSDN.

if not at what point are you needing help! If somethings hard to do, its not worth doing - Homer Simpson
 
You may need to setup the commport (baudrate etc.).

Also realize that mscomm1.input is just what you say "a one liner". Once read you're done, whether or not something was in the buffer. It's better to act upon comm events and then read the input buffer.
Greetings,
Rick
 
As you're using MSComm, I assume you're using VB6 or VBNet.
1) Can you exchange I/O using the free HYPERLINK? (It
should be under Start|Programs|Accessories.)
This should ensure that you're using the proper
type of cable (regular PC-to-modem or PC-to-PC)
and communications settings, ie 9600 baud, 8-N-1.
Until you can do this, you're not sure you're even
connecting.
2) In Form|Load, you must specify these settings in
code.

But do #1 first! See if you're even connecting.
 
As I mentioned it seems to work fine with this one line of code!

Obviously i'm going to put in extra code to perform functions after I have received something from the msr.

I have never used the comm control and was just thinking it can't be this easy! hehe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top