PRB: eVB: Omitting Certain Optional Parameters for Move Method Gives "Type Mismatch" Error (262501)



The information in this article applies to:

  • Microsoft eMbedded Visual Basic 3.0

This article was previously published under Q262501

SYMPTOMS

If you are not supplying certain optional parameters for the Move method of an intrinsic eMbedded Visual Basic control, you may get the error message
An error occurs while running this application : type mismatch
when you run the program.

This problem can also been seen with the same code running in Microsoft Visual Basic 6.0. The error message in this case is:
runtime error 448: named argument not found

CAUSE

This problem happens because you must specify all arguments in the order the syntax requires. In the Visual Basic 6.0 documentation for the Move method, it states:

Only the left argument is required. However, to specify any other arguments, you must specify all arguments that appear in the syntax before the argument you want to specify. For example, you can't specify width without specifying left and top. Any trailing arguments that are unspecified remain unchanged.

This also applies to eMbedded Visual Basic.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Pocket PC or HPC Pro project in eMbedded Visual Basic. Form1 is created by default.
  2. Add a command button and a text box to Form1.
  3. Paste the following code into Form1:
    Private Sub Command1_Click()
      On Error Resume Next
      Text1.Move 100, , , 100
       MsgBox Err.Number & vbCrLf & Err.Description
    End Sub
    					
  4. Run the project and click the command button. The following error message appears:
    An error occurs while running this application : type mismatch
    This error also occurs if you replace the Text1.Move statement with any of the following lines:
    Text1.Move 100, , 100
    Text1.Move 100, , 100, 100
    Text1.Move 100, 100, , 100
    					

Modification Type:MajorLast Reviewed:10/15/2002
Keywords:kbBug kbDSupport kbprb KB262501