?
Solved

MSComm control OnComm event triggered by chr(13)

Posted on 2007-10-16
3
Medium Priority
?
454 Views
Last Modified: 2013-12-26
Using the MSCOMM control in VB6 (XP Pro) , is there any way to have the control generate the 'OnComm'
event when it sees a <cr>?  I would like to have it not generate commevent 2 until the entire line is read in.
Line lengths are variable, so I can't use a fixed length input. Thanks!
0
Comment
Question by:LongDave
3 Comments
 
LVL 26

Accepted Solution

by:
EDDYKT earned 750 total points
ID: 20086569
you need to take care from your code
0
 
LVL 38

Assisted Solution

by:PaulHews
PaulHews earned 750 total points
ID: 20086918
No this is not possible.  The technique you need to use is to store the incoming data in a string until the CR is detected:
Private mstrIN As String


Private Sub MSComm1_OnComm()
   
    If MSComm1.CommEvent = 2 Then
        mstrIN =mstrIN & MSComm1.Input
       
       
        If InStr(1, mstrIN, vbCr) Then
            '... handle the input here.
        End If
   
    End If
0
 

Author Comment

by:LongDave
ID: 20087013
Thanks, guys - this is what I thought, but it's nice to have it verified. PaulHews - what you showed me
is exactly the way I'm already doing it :-). I was just hoping there was the <cr> alternative possible.. Thanks again!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Six Sigma Control Plans
Introduction to Processes

862 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