FIX: Setting InBufferCount Property Generates Error

ID: 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.


MORE INFORMATION

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. 
          Private Sub Command1_Click()
             On Error Resume Next
             Comm1.InBufferCount = 0
             If Err.Number <> 0 Then MsgBox Err.Number & _
             " " & Err.Description
          End Sub 
  8. Run the project and click the CommandButton.



REFERENCES

For additional information, please see the following article in the Microsoft Knowledge Base:

Q185204 HOWTO: Use the Control Manager in CE Toolkit for Visual Basic

Additional query words: wce wince vbce vbce5 vbce6

Keywords : kbToolkit kbVBp500 kbVBp600fix kbWinCE100 kbGrpVB
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: July 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.