Microsoft KB Archive/180767

{|
 * width="100%"|

FIX: Form Move Event Can Generate Error Message

 * }

Q180767

-

The information in this article applies to:


 * Microsoft Windows CE Toolkit for Visual Basic 5.0, version 1.0

-

SYMPTOMS
When the Move method of a form or control is used without all of the parameters, one of the following error messages is generated:

An error was encountered while running this program.

-or-

Wrong number of arguments or invalid property assignment.

RESOLUTION
The workaround is to use all of the parameters of the Move method.

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in Windows CE Toolkit for Visual Basic 6.0.

Steps to Reproduce Behavior
 Create a new Windows CE project in Visual Basic 5.0. Form1 is created by default.  Add the following code to the Form1 code module:

     Private Sub Form_Load On Error Resume Next Form1.Width = 200 * Screen.TwipsPerPixelX Form1.Height = 100 * Screen.TwipsPerPixelY 'Center Form on screen Form1.Move (Screen.Width - Form1.Width) \ 2, _ (Screen.Height - Form1.Height) \ 2 'Display error information If Err.Number <> 0 Then MsgBox "Error: " & Err.Number & " - " & _ Err.Description, vbInformation, "Error Message" End If     End Sub  Press the F5 key to run the project. A message box appears with the message "Error 450: Wrong number of arguments or invalid property assignment." NOTE: By trapping the error message, a more descriptive message can be displayed. Otherwise, the message "An error was encountered while running this program" appears.

(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Mike Dixon, Microsoft Corporation.

Additional query words: vbce5 vbce6 vbce

Keywords : kbToolkit kbVBp kbVBp500bug kbVBp600fix kbOSWinCEsearch kbOSWinCE100 kbGrpDSVB

Issue type : kbbug

Technology : kbVBSearch kbAudDeveloper kbWinCETKVBSearch kbWinCESearch kbWinCETK100VB500