Microsoft KB Archive/187542

{|
 * width="100%"|

FIX: Setting InBufferCount Property Generates Error

 * }

Q187542

-

The information in this article applies to:


 * Microsoft Windows CE Toolkit for Visual Basic 5.0

-

SYMPTOMS
When you attempt to set the InBufferCount property of the MSCEComm control in Windows CE Toolkit for Visual Basic 5.0 (VBCE), the following error message appears:

450 "Wrong number of arguments or invalid property assignment."

CAUSE
The InBufferCount property is read-only in Windows CE Toolkit for Visual Basic 5.0. The standard Comm control that ships with Visual Basic allows the programmer to set the InBufferCount to zero to empty the input buffer.

RESOLUTION
To clear the input buffer, simply call the MSCEComm control's Input method, which will read and clear the input buffer as shown in the following code:

  Private Sub cmdClearBuffer_Click On Error Resume Next Dim clear clear = Comm1.Input If Err.Number <> 0 Then MsgBox Err.Description End Sub

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Windows CE Toolkit for Visual Basic 6.0.

Steps to Reproduce Behavior

 * 1) Start a new Windows CE project in Visual Basic 5.0. Form1 is created by default.
 * 2) Add a CommandButton (Command1) to Form1.
 * 3) Use the Control Manager to install and register the MSCEComm control in emulation. For more information, see the REFERENCES section of this article.
 * 4) Select Components from the Project menu, and then select the Microsoft CE Comm Control 1.0.
 * 5) Add a MSCEComm control (Comm1) to Form1.
 * 6) Add the following code to the Command1 Click Event:
 * 7) Run the project and click the CommandButton.