FIX: Form Move Event Can Generate Error Message

ID: Q180767


The information in this article applies to:


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 listed at the beginning of this article.

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


MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Windows CE project in Visual Basic 5.0. Form1 is created by default.


  2. 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 


  3. 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 kbWinCE kbWinCE100 kbGrpVB 
Version           : WINDOWS:1.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: February 25, 1999