Mscomm1 Event "Case comEvCTS"

/*************************************************************
Question: how could i know the receiveing is ended.
        Case comEvReceive                                   '2 Receive event.
            Buf = Buf & MSComm1.Input                  'store all
        Case comEvCTS    
                    why this part is not working ???????
please help urgent
*************************************************************/
 
With MSComm1
       .CommPort = 1                       'Port
         .Handshaking = comRTSXOnXOff
           .RThreshold = 1                     'Fire OnComm event with
                                                    'a single character in input buffer
           .RTSEnable = True
         .Settings = "9600,N,8,1"  'Baud
        .SThreshold = 1
      .PortOpen = True                    'Open now
End With

Private Sub MSComm1_OnComm()
   
    Select Case MSComm1.CommEvent
        Case comEvSend                                      '1 Send event.
        Case comEvReceive                                   '2 Receive event.
            Buf = Buf & MSComm1.Input
        Case comEvCTS                                       '3 Change in clear-to-send line.
            t_RCV.Text = t_RCV.Text & Buf & vbCrLf & "="
            v_Buf = ""
            t_RCV.SelStart = Len(t_RCV.Text)
        Case comEvDSR                                       '4 Change in data-set ready line.
        Case comEvCD                                        '5 Change in carrier detect line.
        Case comEvRing                                      '6 Ring detect.
        Case comEvEOF                                       '7 End of file.
            'errors
        Case comEventBreak                                  '1001 A Break signal was received.
        Case comEventFrame                                  '1004 Framing Error. The hardware detected a framing error.
        Case comEventOverrun                                '1006 Port Overrun. A character was not read from the hardware before the next character arrived and was lost.
        Case comEventRxOver                                 '1008 Receive Buffer Overflow. There is no room in the receive buffer.
        Case comEventRxParity                               '1009 Parity Error. The hardware detected a parity error.
        Case comEventTxFull                                 '1010 Transmit Buffer Full. The transmit buffer was full while trying to queue a character.
        Case comEventDCB                                    '1011 Unexpected error retrieving Device Control Block (DCB) for the port.
   
    End Select

End Sub
mohittipuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
Hi mohittipu,

comEvCTS is used to detect a change in the "Clear-To-Send" control line. This may not work because the cable is not wired with this line in place or because you have not enabled cts or because it is not implemented in the device you are connnecting to. It is not simply a property of every configuration and something that tells you that you have finished receiving, it is up to you to know what information you are expecting back from the device and from that know it has finished or you have to simply accept every bit of data and handle in your program as appropriate.

Tim Cottee

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
codeconquerorCommented:
I would implement some sort of timeout in the program (i.e. if data is received, then when data stops being received for 30 seconds, then data transmission is complete), or if you are designing both ends of the program then sending a message to indicate end of transmission would be the best way.
Shiju SasidharanSenior IT DeveloperCommented:
>>how could i know the receiveing is ended.

it depends on the data sent by the device u connected to ur port.

if u have set
 .RThreshold = 1  
then for each character received  u will get a trigger in OnComm event
and once u make
     MSComm1.Input
then the reading is finished

EugeneK-biruzaCommented:
Maybe it would be better to use a 3rd-party and forget about such problems?

Here is some very good stuff:

COMM-DRV/Lib
http://www.devarchive.com/f1073.html

and

Serial Port ActiveX Control
http://www.devarchive.com/f2173.html

to choose from
EugeneK-biruzaCommented:
Is your problem resolved? Maybe it would be fair to split points between guys who tried to help?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.