VBCE.com - The Premier Website For Visual Basic/CE Developers

 

*Dev Corner

Sample Code
Controls
Workarounds
Tips & Tricks
Q & A
Forums

*Goodies
Downloads
Software
Bookstore


*General
Home
What's New
General Info
Misc. Info


*News Worthy
News
Articles
Editorials
KB Articles
Reviews
Awards

*Miscellaneous
Web Links
Partners
Search
Feedback
Advertising

<% On Error Resume Next SiteStats() %>

Sponsors


More...


Clear the InBufferCount
By mike@vbce.com

    The Comm control has a bug where the InBufferCount property is read-only when it really should be read-write.

    To work around this bug simply read the contents of the input buffer to clear it. Below is a reuseable routine that does this for you. Here is a command1 click event that will call the reusable routine to clear the buffer.

Private Sub Command1_Click()
    'Workaround for the InBufferCount bug
    InBufferClear Comm1
End Sub

Public Sub InBufferClear(CommControl)
    '================================
    'PURPOSE: Clear the Comm buffer
    ' (set InBufferCount = 0)
    'PARAMS: CommControl = A Comm
    ' Control Reference
    '===============================

    Dim Dummy
    Dummy = CommControl.Input
End Sub

bug_word.jpg (1504 bytes)
bug_ant_1.gif (13248 bytes)
workaround.jpg (2931 bytes)

 

“When the bugs get tough,
the tough get coding!”

 

VBCE.com is DevX Winner!

Unless otherwise noted, all information on VBCE.com is Copyright 1998 - 2002
Windows, Windows CE, and Visual Basic are trademarks of the Microsoft Corporation.
VBCE.com is not responsible for content on external sites.
Send all feedback to webmaster@vbce.com
Webmasters - feel free to link to
VBCE.com - Premier Website for Visual Basic/CE Development

Buy Books!