Why MSComm.InBufferCount comparison affectS MSComm.Input content? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Why MSComm.InBufferCount comparison affectS MSComm.Input content?

case4044case4044 Posts: 4Member
Programming Language = Visual Basic 6 (SP6a)
Related To : Having MSComm to accept signal returned from Serial COM Port

My intention is to compare if the MSComm1.InBufferCount is larger than a specified number, then assign the ENTIRE ORIGINAL MSComm1.Input to InputBytes.

My Sample Codes:-
Dim InputBytes() As Byte
Dim iCheckNumber As Interger

Do While MSComm1.PortOpen
If MSComm1.InBufferCount >= iCheckNumber Then 'expect structure length
InputBytes = MSComm1.Input ' In coming data from serial port
Exit Do ' Exit loop
End If

My Finding:-
If iCheckNumber = 50 ; InputBytes = ` 00000000066090083628147 000000416902588
If iCheckNumber = 75 ; InputBytes = ` 00000000066090080911987 000000416903588734702681597949121544

My Question:-
I would like to know whether my findings is true? Is there any better way to achieve the result I wish.

Sign In or Register to comment.