# Errors

The following are error messages generated by the compiler when something in your code wasn't understood.

**A Method with a ParamArray Cannot have any Optional Parameters**

You cannot use the `Optional</api/language/optional>` keyword in a parameter list containing the `ParamArray</api/language/paramarray>` keyword.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**A ParamArray cannot be Passed by Reference**

You tried to declare a parameter using both the `ParamArray</api/language/paramarray>` and `ByRef</api/language/byref>` keywords. Parameters declared as ParamArray cannot be passed by reference.

This invalid parameter declaration causes this error:

``` xojo
ParamArray ByRef a() As Integer
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**A ParamArray cannot have a Default Value**

When you declared a parameter using the `ParamArray</api/language/paramarray>` keyword, you gave it a default value. This is not valid.

The following method declaration is not valid:

``` xojo
Sub AddNumbers(ParamArray Nums As Integer = 10)
```

You must remove the assignment statement at the end of the declaration.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**A ParamArray's Element Type may not be Another Array**

You tried to use the `ParamArray</api/language/paramarray>` keyword with an array parameter in a method declaration.

This method declaration uses the `ParamArray</api/language/paramarray>` keyword with an array parameter. There's no need to do this. You can pass an indefinite number of elements by declaring the parameter `ParamArray</api/language/paramarray>` OR by passing an array to the method. You cannot use both techniques at once.

``` xojo
Sub myMethod(ParamArray b() As String)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**A Parameter passed by Reference Cannot have a Default Value**

In the method declaration, you declared a parameter `ByRef</api/language/byref>` but also tried to assign it a default value.

The following parameter declaration is not allowed

``` xojo
ByRef a As Integer = 5
```

You can either remove the `ByRef</api/language/byref>` keyword or remove the default value assignment.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**A Var Statement creates only one new object at a time**

You used the optional `New</api/language/new>` operator in a `Var</api/language/var>` statement to instantiate two or more objects. You cannot use the `New</api/language/new>` operator in a `Var</api/language/var>` statement that declares more than one variable. You can, for example, declare multiple variables with the `Var</api/language/var>` statement and then use separate statements to instantiate them. Your other option is to use the optional `New</api/language/new>` operator in separate `Var</api/language/var>` statements.

<div class="note">

<div class="title">

Note

</div>

This error and the explanation of it applies to the `Dim</api/language/dim>` statement as well.

</div>

The following statement produces this error:

``` xojo
Var n, m As New FolderItem
```

Either of the following is correct. In the first case, all variables are declared in one statement and instantiated separately.

``` xojo
Var n, m As FolderItem
n = New FolderItem
m = New FolderItem
```

Using separate `Dim</api/language/dim>` statements:

``` xojo
Var n As New FolderItem
Var m As New FolderItem
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**An Assigns Parameter cannot have a Default Value**

You specified a default value for a parameter that used the `Assigns</api/language/assigns>` keyword. This is not valid.

The following method declaration is not permitted.

``` xojo
Sub theVolume(a As Integer, b As Integer, Assigns c As Integer = 10)
```

You must remove the assignment statement.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**An Extends Parameter cannot have a Default Value**

You assigned a default value to a parameter that uses the `Extends</api/language/extends>` keyword.

The following parameter declaration is not acceptable.

``` xojo
Extends C As Color = &cFF0000, Amt As Integer
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**An Ordinary Parameter cannot Follow a ParamArray**

You declared an "ordinary" parameter as the second parameter after a parameter that was declared as `ParamArray</api/language/paramarray>`. This is not allowed. Pass only the parameter declared as `ParamArray</api/language/paramarray>`.

In the following declaration, m is the 'ordinary' parameter that is not allowed.

``` xojo
Sub myMethod(ParamArray n As Integer, m As Integer)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Array Bounds must be Integers**

You used a non-integer in a `Var</api/language/var>` statement when trying to declare an array. You can use `Integer</api/data_types/integer>` constants to dimension an array, but not non-integers.

``` xojo
Var aPicture (5.2) As String
Var aProps (True) As Boolean
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Assigns can only be used on the last parameter**

You used the `Assigns</api/language/assigns>` keyword in a Method declaration for a parameter other than the last parameter. Assigns must be the last parameter or the only parameter.

The following declaration incorrectly uses the `Assigns</api/language/assigns>` keyword for the first parameter, causing this error:

``` xojo
Sub SquareIt(Assigns x As Double, y As Double)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Cannot Assign a Value to this Property**

You tried to assign a value to a constant or other object type that does not accept a value.

Assigning a value to a constant:

``` xojo
Const SerialPort = 1080
SerialPort = 1040
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Cannot Get this Property's Value**

You tried to read a value for a property when it had no value.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Declaration Contains a Reserved Word**

You used a Var statement while declaring a property in the Add Property area. Var is used only for declaring local variables.

The Var keyword should be omitted this declaration:

``` xojo
Var TextHasChanged As Boolean
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Destructors Can't Have Parameters**

You cannot define parameters for a class's destructor.

A destructor is a special method of a class that is named "`Destructor</api/language/destructor>`". It executes automatically when the class goes out of scope.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**End Quote Missing**

An end quote was missing from a literal text or string.

An end quote is missing from the following `String</api/data_types/string>` passed to the `MessageDialog</api/user_interface/desktop/messagedialog>` command:

``` xojo
MessageBox("Hello world)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Exception Objects Must be of Type RuntimeException**

You declared an exception variable as something other than a `RuntimeException</api/exceptions/runtimeexception>` or a subclass of `RuntimeException</api/exceptions/runtimeexception>`.

The following declaration produces this error:

``` xojo
Exception error As Double
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Expected (%1), but these arguments are (%2)**

You passed parameters of an incorrect data type to a method.

The RGB function expects integer values, so this incorrect code does not compile:

``` xojo
Var c As Color
c = Color.RGB("red", "green", "blue")
```

You get this error: Expected (Integer, Integer, Integer), but these arguments are (TextLiteral, TextLiteral, TextLiteral)

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Extends can only be used on the first parameter**

You used the `Extends</api/language/extends>` keyword more than once and/or on a parameter other than the first parameter.

``` xojo
Sub myNewMethod(x As Integer, Extends f As FolderItem)
```

Should be rewritten as:

``` xojo
Sub myNewMethod(Extends f As FolderItem, x As Integer)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**External Functions Cannot Use Objects as Parameters**

This error occurs if you `Declare</api/language/declare>` an external function and try to specify that one of its parameters is an object.

When passing a `MemoryBlock</api/language/memoryblock>` to a `Declare</api/language/declare>`, use Ptr instead. When passing a window to a `Declare</api/language/declare>`, use WindowPtr instead.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**External Functions Cannot Use String Data Types as Parameters**

Occurs if one of your `Declare</api/language/declare>` statement's parameters is an standard `string</api/data_types/string>`. Use `CString</api/data_types/additional_types/cstring>` or `PString</api/data_types/additional_types/pstring>` instead.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**GoTo Target Not Found**

You used a label in a `GoTo</api/language/goto>` statement that is not used in the method. Therefore, the jump could not be executed.

The example from the `GoTo</api/language/goto>` keyword is modified so that there is no code that is identified by the label used in the `GoTo</api/language/goto>` statement.

``` xojo
If Checkbox1.Value Then
  GoTo myCode
End If

' Return used to keep RB from executing the labelled statement anyway
Return
myLabel: ' does not match label in GoTo
MessageBox("Unstructured programming is bad")
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Logic Operations require Boolean Values**

You used a variable that was not of type `Boolean</api/data_types/boolean>` or an expression that did not evaluate to a Boolean where a `Boolean</api/data_types/boolean>` was expected.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Me Cannot be used in a method of a module**

You can't use Self or Me in a method or function in a module because there is no parent window or control. Self can be used only when there is a parent window for the method and Me can be used only in a control's event handler.

<div class="seealso">

`Self</api/language/self_keyword>`, `Me</api/language/me>` keywords.

</div>

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**One of the Interfaces of this Class is not of Type Class Interface**

In the Properties pane for a Class Interface, you entered the name of a class in the Interfaces field that is not of type Class Interface. This occurs if you use the name of any 'ordinary' class instead of the name of a class interface.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Only Boolean Constants can be Used with If**

Only `Boolean</api/data_types/boolean>` constants can be used with `＃If...＃EndIf</api/compiler_directives/if...endif>` statements.

A 'regular' `Boolean</api/data_types/boolean>` variable cannot be used as shown here.

``` xojo
Var b As Boolean
b = True
#If b Then
  System.Beep
#EndIf
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Only One Parameter may use the Assigns Option**

You used the `Assigns</api/language/assigns>` keyword with more than one parameter. You can use `Assigns</api/language/assigns>` with only one parameter and it must be the last parameter.

The following method declaration uses `Assigns</api/language/assigns>` twice.

``` xojo
Sub myMethod(Assigns a As Integer, Assigns b As Integer)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Only One Parameter may use the ParamArray Option**

You tried to pass more than one parameter using the `ParamArray</api/language/paramarray>` keyword. You can pass only one parameter that uses the `ParamArray</api/language/paramarray>` keyword. If there is more than one parameter, the `ParamArray</api/language/paramarray>` keyword should be used for the last parameter.

The following method declaration uses the `ParamArray</api/language/paramarray>` keyword twice.

``` xojo
Sub myMethod(ParamArray a As Integer, ParamArray s as String)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Only String Constants can be used for Declaring Libraries**

Occurs when you've declared an external function using a constant, but either the constant is not defined or it contains something other than a string.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Only the First Parameter may use the Extends Option**

You tried to use the `Extends</api/language/extends>` keyword for any parameter other than the first parameter.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Only the Last Parameter may use the Assigns Option**

You used the `Assigns</api/language/assigns>` keyword with any parameter other than the last parameter. The `Assigns</api/language/assigns>` keyword can only be used for one parameter and it must be the last parameter.

The following method declaration uses the `Assigns</api/language/assigns>` keyword for the first parameter.

``` xojo
Sub myMethod(Assigns a As Integer, b As Integer)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Parameter and Default Value Must be of the Same Type**

You used a value of an incorrect data type as a default value. When you create a method in the Add Method declaration area, you can optionally set a default value for each of the parameters. Of course, the data type of the default value must match the data type of the parameter.

Consider the following parameter declaration:

``` xojo
s As String = 15
```

Since s is declared as a `String</api/data_types/string>`, its default value must be a `String</api/data_types/string>`. 15 isn't

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Parameters are not Compatible with this Function**

You passed parameters of an incorrect data type to a function.

The `Color<color.rgb>` function expects integer values:

``` xojo
Var c As Color
c = Color.RGB("red", "green", "blue")
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Self Cannot be used in the Method of a Module**

You can't use `Self</api/language/self_keyword>` or `Me</api/language/me>` in a method or function in a module because there is no parent window or control.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Super Cannot be used in a Module Method**

The concept of Super applies only to the Class hierarchy, so it has no meaning in a method of a module.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Syntax**

Any number of miscellaneous errors that were not identified by more specific error messages has occurred.

An omitted closing parenthesis:

``` xojo
If (d > 0 Then
.
End If
```

An incorrect `Var</api/language/var>` statement:

``` xojo
Var d Double ' omitting 'as'
Var f ' omitting 'as' and data type
Var As Boolean ' no variable name
Var Double As Double ' 'Double' is a reserved word
Var a b As Integer ' should be 'a,b'
Var c As ' type missing
Var myFlag As True ' illegal type and use of reserved word
```

The 'Then' keyword is missing from an `If</api/language/if>` statement:

``` xojo
Var a As Integer
a = 5
If a > 0 ' needs to be If a > 0 Then
  MessageBox("Boo")
End If
```

The ElseIf statement was not preceded by an `If</api/language/if>` statement.

``` xojo
Var i,j,k As Integer
' do something
ElseIf j > 0 Then
  ' do something else
End If
' Correct
If j = 0 Then
.
ElseIf j > 0 Then
.
End If
```

The End If keyword is missing from an `If</api/language/if>` statement:

``` xojo
Var dayNum As Integer
If dayNum = 1 Then
  MessageBox("It's Monday")
  ' end if needed
```

An "#else" used instead of Else with a `＃If...＃EndIf</api/compiler_directives/if...endif>` statement (conditional compilation).

``` xojo
Var c As Color
#If TargetMacOS Then
  b = Color.SelectedFromDialog(c, "Select a Color")
  Else ' should be #else
  System.Beep
#EndIf
```

The Next keyword is missing from a `For</api/language/loops/for...next>` loop:

``` xojo
Var I, j As Integer
Var aInts(2, 2) As Integer
For i = 0 To 2
For j = 0 To 2
  aInts(i, j) = i * j
Next
' final 'Next' missing here
```

One too many Next keywords are used in this example:

``` xojo
Var i, j As Integer
Var aInts(2, 2) As Integer
For i = 0 To 2
  For j = 0 To 2
    aInts(i , j) = i * j
  Next
Next
Next ' too many "nexts"
```

Omitting the Wend keyword from a `While</api/language/loops/while...wend>` loop:

``` xojo
While I < 10
  System.Beep
Next ' should be Wend
```

Omitting the `While</api/language/loops/while...wend>` statement:

``` xojo
Var i As Integer
i = 1
' While statement missing here
System.Beep
i = i + 1
Wend
```

The Loop keyword is missing from a `Do</api/language/loops/do...loop>` statement:

``` xojo
Var i As Integer
Do Until i = 5
  System.Beep
  i = i + 1
' missing Loop statement
```

A Loop keyword was used without a preceding (matching) `Do</api/language/loops/do...loop>` statement

``` xojo
Var x As Integer
' Do statement missing
x = x + 1
Loop Until x > 100
```

The End Select keyword is missing from a `Select Case</api/language/select_case>` statement:

``` xojo
Select Case x
Case 1
  MessageBox("The party of the first part.")
Case 2
  MessageBox("The party of the second part.")
' no matching End Select statement
```

The `Select Case</api/language/select_case>` statement is missing:

``` xojo
Var day As String
Case 1 ' Select Case statement missing
  day = "Monday"
Case 2
  day = "Tuesday"
End Select
```

The `Sub</api/language/sub>` and `Function</api/language/function>` statements cannot appear inside a method.

``` xojo
Sub MyMethod(x As Integer, y As Integer)
Sub MyMethod(x As Integer, y As Integer)
.
```

A comma indicates that the second, required parameter is missing:

``` xojo
ListBox1.AddRowAt(2,)
```

Using an equals sign when it is not necessary:

``` xojo
Return = x * y ' equals sign should be a space
```

A keyword was misspelled:

``` xojo
If dayNum = 1 Then
  MessageBox("It's Monday")
End Fi  ' should be End If
```

A space rather than a comma is used to separate variable names in a `Var</api/language/var>` statement:

``` xojo
Var a b As Integer ' should be 'a,b'
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**The Counter variable and the Variable Following Next Must be the Same**

In a `For...Next</api/language/loops/for...next>` loop, if you use both a counter variable and a variable in the Next statement, they must match. The variable on the Next statement can be omitted.

In the following `For...Next</api/language/loops/for...next>` loop, the counter variable is i, so the variable on the Next statement must also be i:

``` xojo
Var i, j As Integer

For i = 1 To 10
  j = j + 1
Next j ' Should be i or omit it entirely
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**The Size of an Array Must Be a Constant or a Number**

When you declare and size an array using a `Var</api/language/var>` statement, the size of the array must be indicated by either a constant or a number.

If you need a variable length array, declare the array as having no bounds and then use the `Arrays<arrays.add>` method to add elements, such as:

``` xojo
Var myArray (-1) As Integer
myArray.Add(5)
```

Trying to size an array using a variable:

``` xojo
Var j As Integer
j = 5
Var a(j) As Integer
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**The keyword 'Then' is expected after this If statement's condition**

You neglected to type the 'Then" keyword after the `Boolean</api/data_types/boolean>` condition in an `If</api/language/if>` statement. To eliminate the possibility of this error, type Shift+Enter after typing

``` xojo
If *condition*
```

The Code Editor will then add the "Then" after the condition, add the End If statement and place the cursor in between the two.

Another shortcut is to write only the statements that meet the condition (inside the If...End if), select them, and then choose Wrap in If...End If from the Code Editor contextual menu. This will surround your statements with IF condition Then above and End If below.

``` xojo
If error = -123   //needs a 'Then' right here
  System.Beep
  MessageBox("Whoops! An error occured.")
End If
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**There is no Class with this Name**

You used a nonexistent class name.

Using nonexistent class names on a `Var</api/language/var>` statement.

``` xojo
Var fred As Husband ' 'Husband' not a data type
Var f As Folder ' should be FolderItem
Var d As longdouble ' no such thing; programmer is lost
```

Using a nonexistent class with the `New</api/language/new>` operator.

``` xojo
Var f As FolderItem
f = New Folder
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Array Has Fewer Dimensions than You Have Provided**

You tried to execute a built-in array method that requires a one-dimensional array on a multi-dimensional array.

You can't sort a two-dimensional array.

``` xojo
Var aInts(3, 3) As Integer
Var i, j As Integer

For i = 0 To 2
  For j = 0 To 2
    aInts(i, j) = i * j
  Next
Next

aInts.Sort ' doesn't work on 2D arrays
```

Using syntax that indicates that you are referencing an element in a two-dimensional array when it has been declared as a one-dimensional array:

``` xojo
Var aInts(3) As Integer
aInts(0, 0) = 3 ' incorrect
```

Trying to change a one-dimensional array to a two-dimensional array with a `Arrays<arrays.resizeto>` statement:

``` xojo
Var aInts(3) As Integer
```

``` xojo
aInts.ResizeTo(5, 5)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Array Has More Dimensions than You Have Provided**

In referring to an element of a multidimensional array, you didn't provide subscripts for all the dimensions.

``` xojo
Var a(5, 4) As String
a(1) = "Bob"
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Array Method Works for only One-dimensional Arrays**

You tried to execute a method that operates only on one-dimensional arrays on a multi-dimensional array.

The following code tries to use the `Arrays<arrays.add>` method with a two-dimensional array.

``` xojo
Var aTest(3, 3) As String
Var i, j As Integer

For i = 0 To 3
  For j = 0 To 3
    aTest(i, j) = i.toString + j.ToString
  Next
Next

aTest.Add("Frank") ' can't use Add here.
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Class is Missing One or More Methods of an Interface it Implements**

One or more of the methods of the class interface that this class implements could not be found in this class, even though it claims to implement the class interface.

When you specify the properties of a class in its Properties pane, you can optionally specify a class interface for the class. When you do so, the class must have its own methods of the same names as the names of the methods in this class interface. The matching methods must use the same parameter types and return types as the corresponding method in the class interface.

If you omit one or more of these methods, then you will receive this error. When you attempt a debug build, a dialog box will appear that gives this error message and contains a list of all the methods that the class is required to have.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Global Variable has the Same Name as a Class**

You created a global variable in a module that uses the same name as one of the classes in your project.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Global Variable has the Same Name as a Global Function**

You reused the name of a method or function in a module as the name of a property in a module.

Defining "myMessageBox" as a method in a module and also defining "myMessageBox" as a property in the module.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Global Variable has the Same Name as a Module**

You reused the name of a module as the name of a module property whose scope is Global.

Defining a module named "Arthur" and creating a property in the module that's also named "Arthur" and has Global scope.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Item Conflicts with Another Item of the Same Name**

Occurs when you are calling an overloaded method and the compiler cannot determine which version you meant to call. This happens when two methods have the same name, number of parameters, and the data types of the parameters match.

This error will also occur if a method name conflicts with another type of project item such as a window, menuitem, control, and so forth. For example, if you have a global function named Foo and a window called Foo.

The method myOverLoadedMethod takes three `integer</api/data_types/integer>` parameters, but it is defined twice (performing different functions) in a window's Code Editor. A call to myOverLoadedMethod produces the error. The solution is to rename or eliminate the second instance of myOverLoadedMethod.

Instance 1

``` xojo
Sub MyOverLoadedMethod(a As Integer, b As Integer, c As Integer)
  Var d As Integer
  d = a * b / c
  MessageBox(d.ToString)
End Sub
```

Instance2

``` xojo
Sub MyOverLoadedMethod(x As Integer, y As Integer, z As Integer)
  Var d As Integer
  d = x / z * y
  MessageBox(d.ToString)
End Sub
```

Calling method

``` xojo
Var a, b, c As Integer
a = 5
b = 10
c = 15
MyOverloadedMethod(a, b, c)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Kind of Array Cannot be Sorted**

You tried to sort a `Boolean</api/data_types/boolean>` array or an array of objects.

You tried to sort an array of objects instead of an array of alphas or numbers. For example, an array of `DateTime</api/data_types/datetime>` objects cannot be sorted, but an array of `SecondsFrom1970<datetime.secondsfrom1970>` properties of `DateTime</api/data_types/datetime>` objects can be sorted, since the `SecondsFrom1970<datetime.secondsfrom1970>` property is a `Double</api/data_types/double>`.

This example array cannot be sorted.

``` xojo
Var d(2) As DateTime
d(0) = New DateTime(1965, 1, 19)
d(1) = New DateTime(1970, 1, 19)
d(2) = New DateTime(1950, 1, 19)
d.Sort
```

The last line of this example produces the error message.

``` xojo
Var theTruth(3) As Boolean
theTruth(0) = True
theTruth(1) = True
theTruth(2) = False
theTruth(3) = False
theTruth.Sort
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Local Variable or Constant has the Same Name as a Declare in this Method**

You used the name of a local variable or local constant in a `Declare</api/language/declare>` statement in a method.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Local Variable or Parameter has the Same Name as a Constant**

You reused the name of a constant in a `Var</api/language/var>` statement or a parameter declaration.

Reusing the name of a constant in a local variable.

``` xojo
Const PI = 3.14
Var PI As Double
pi = 3.1416
```

Reusing the name of a parameter as a constant:

``` xojo
Sub MyGreatGlobalMethod(PI As Double)
  Const PI = 3.1416
End Sub
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Method Doesn't Return a Value**

You used a method in an expression as though it returned a value, but it doesn't.

The user-written method myColor is not a function, so this syntax in a calling method is not correct

``` xojo
Var c As Color
c = myColor ' does not return a color
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Method Requires Fewer Parameters than were Passed**

You passed too many parameters to a method. Another possibility is that you passed the required number of parameters but did not separate them with commas.

Passing the required number of parameters but omitting a comma

``` xojo
ListBox1.AddRow 2 "Chicago"
```

Passing too many parameters:

``` xojo
ListBox1.AddRowAt 2, "Charlie", "Dallas"
```

The user-written function, myFunction, takes two parameters:

``` xojo
Var d As Double
d = myFunction(5, 6, 8)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Method Requires More Parameters than were Passed**

You didn't pass all the required parameters to a method. Another possibility is that you passed the required number of parameters but did not separate them with commas.

Passing the required number of parameters but omitting a comma

``` xojo
ListBox1.AddRowAt 2 "Chicago"
```

Passing too few parameters:

``` xojo
ListBox1.AddRow "Chicago"
Var c As Color
c = Color.RGB(100, 100) ' returns "RGB takes 3 parameters"t
```

In the following examples, myFunction takes two parameters and returns a `Double</api/data_types/double>`:

``` xojo
d = myFunction(5, 6) ' correct
d = myFunction (5, 6) ' also correct
d = myFunction 5, 6 ' error
d = myFunction ' also an error
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Method is too Long**

The method is longer than the compiler can handle. It is very unlikely that you will see this error.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Method or Property Does Not Exist**

You used a syntax that implies that a term is a method or property, but it does not exist. It also occurs when you use a variable in an assignment statement but omit the equals sign, making it appear that it is a method or property.

Calling a method that has not been defined:

``` xojo
Var aFiles(3) As FolderItem
aFiles.List ' no such thing
```

Assigning a value to a variable that has not been declared using a `Var</api/language/var>` statement

``` xojo
i = 10
```

This is the Pressed event handler of a `DesktopButton</api/user_interface/desktop/desktopbutton>`; the user wants to display the caption property of the `DesktopButton</api/user_interface/desktop/desktopbutton>`.

``` xojo
MessageBox(caption) ' should be me.caption*
```

Trying to set in code a property that can only be set in the Properties pane. The following line of code tries to set the value of the Bold property of a `DesktopMenuItem</api/user_interface/desktop/desktopmenuitem>`, but the Bold property is not recognized in code:

``` xojo
SearchFind.Bold = True
```

Using `Me</api/language/me>` in a method or function that is not attached to an object. The following method tries to return the Text property of the calling `DesktopButton</api/user_interface/desktop/desktopbutton>`, but this is not permitted.

``` xojo
Function myText() As String
Return Me.Text
```

You can only access the calling object's properties using `Me</api/language/me>` within an event handler belonging to that object.

The programmer intended to declare aNames as an array in the `Var</api/language/var>` statement but forgot to do so.

``` xojo
Var aNames As String
aNames.AddRow "Walter Kerr"
```

Trying to assign a value to a Private or Protected property that is out of scope. For example, the following line tries to assign a value to a Private property of a module from a window:

``` xojo
myPrivateProperty = 56
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Name is Already in Use**

You used a variable name in a `Var</api/language/var>` statement that has already been declared in another `Var</api/language/var>` statement or as a property. Or, you tried to declare a property with the same name as another property.

``` xojo
Var a, b As Double
Var b As Double ' already in use
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Property Has the Same Name as a Class Method**

You reused a name of a method in a class as the name of a property in the class.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Property Has the Same Name as a Method**

You reused the name of a method as the name of a property.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Property Has the Same Name as an Event**

You used the name of an event as the name of a property. You need to rename the property.

Using 'Open' as both the name of an event and a property in a class.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This Type Conversion is only implemented for one-dimensional Arrays**

You tried to convert the data type for a multi-dimensional array.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This else Does Not Have a Matching If Preceding It**

An extra \#else keyword was used in an `＃If...＃EndIf</api/compiler_directives/if...endif>` statement (conditional compilation) or an \#else statement is used where no \#if preceded it.

An \#Else keyword was used instead of an Else keyword in an `If</api/language/if>` statement.

``` xojo
Var theNumber As Integer
Var digits As Integer
theNumber = 33
If theNumber < 10 Then
  digits = 1
#Else ' should be else
  digits = 3
End If
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This endif Does Not Have a Matching If Preceding It**

An \#If statement was omitted from an `＃If...＃EndIf</api/compiler_directives/if...endif>` structure.

The `If</api/language/if>` statement in this example should be `＃If...＃EndIf</api/compiler_directives/if...endif>`.

``` xojo
If TargetMacOS Then
  System.Beep
#EndIf
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This is a constant; its value can't be changed**

This error occurs when you use a non-constant value in an expression used to define a constant.

``` xojo
Const CR = Chr(13)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This is not An Array but you are using it as One**

You passed an object to a method or function that expects an array but did not get one. It also occurs if you are trying to assign a value to an element of an alleged array but it is not an array.

``` xojo
Var aInts(4) As Integer
Var f As FolderItem
f.ResizeTo(10) ' not an array
Var a As String
a(1) = "Ted" ' not an array
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**This property shadows a property of a different type**

You have a super/subclass that, in the super you have defined a property, and in the subclass you have a property with the same name but a different type.

The following class hierarchy produces this error:

``` xojo
Class SomeSuper
    Property SomeProperty As Integer
End Class

Class SomeSub 
Inherits SomeSuper
    Property SomeProperty As String
End Class
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div id="errors.typemismatch">

**Type Mismatch**

</div>

Occurs when you try to pass a parameter of an incorrect data type to a method or function or use an incorrect data type in an assignment statement. The second line of the error message tells you the data type that expected and the data type that was received.

Trying to assign a `string</api/data_types/string>` to an `Integer</api/data_types/integer>` variable:

``` xojo
Var n as Integer
n = "Anthony"
```

The second line of the error message says, "Expected Int32 but got String."

Trying to assign a value to an array instead of an element of the array.

``` xojo
Var truth(3) As Boolean
truth = True ' must have a subscript
```

The second line of the error message says, "Expected Boolean() but got Boolean."

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**Unknown Pragma Name**

You passed a name to the `#Pragma</api/language/pragma_directives>` keyword that is not a valid pragma. You can only use the pragma directives that are part of the language.

The following string is not valid.

``` xojo
#Pragma myGreatPragma
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Can Only Inherit From a Class**

Occurs only in `XojoScript</api/language/xojo_script/xojoscript>`. It occurs if you set a class's Super class to an interface instead of a real class.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Can't Assign one Array to Another Array**

You tried to assign one array to another array. To create an array that has the same elements of another array, you need to assign each value of one array to the same index value of the other array. Use a `For</api/language/loops/for...next>` statement and loop through all the values of the array index.

``` xojo
Var a(5) As Integer
Var b(5) As Integer
a = b
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Can't Pass an Array to an External Function**

You'll get this on the `Declare</api/language/declare>` statement if you define one of its parameters as an array.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Can't Pass an Expression as a Parameter that is Defined as ByRef**

In a function call, you tried to pass an expression rather than a variable or property to a parameter that was declared as `ByRef</api/language/byref>` in the called method.

The following method takes one parameter that was declared as `ByRef</api/language/byref>`:

``` xojo
Sub Squarit(ByRef c As Double)
c = c * c
```

The calling function is:

``` xojo
Var a, b As Double
a = 5
b = 10
Squarit(a * b) //cannot use an expression here
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Can't Use Super Because this Class has no Super Class**

You can't refer to the Super Class of a class that has no Super Class.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Can't Use This Variable or Property Name Because it is a Reserved Word**

Reserved words are not available as names of user-defined objects. If you used a reserved word as a variable name in a `Var</api/language/var>` statement or as a Property Name, this message will appear.

Using a reserved word, such as a data type (Integer, Double, Boolean, etc.) as the name of a property in the Add Property declaration area.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Can't Use the New Operator with this Class**

You tried to create an instance from an abstract class. You can only use the `New</api/language/new>` operator to create a new instance of a control already in a window, a window added to the project with the Project . Add . Window command or the Add Window button, or an existing menu item. The existing object acts as a template for the new instance.

You also cannot create an instance of a class that is used only as the base class for other classes, such as `DesktopUIControl</api/user_interface/desktop/desktopuicontrol>` or `SocketCore</api/networking/socketcore>`.

Don't do this:

``` xojo
Var w As DesktopWindow
w = New DesktopWindow
```

Instead, use the `New</api/language/new>` operator with an instance of the Window class created with the Project . Add . Window command or the Add Window button in the Project Editor.

``` xojo
Var w As FindWindow
w = New FindWindow
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Cannot Implement a Nonexistent Event**

Occurs only in `XojoScript</api/language/xojo_script/xojoscript>`. You attempted to use an event that is was not previously defined.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Cannot Return a Value Because this Method has No Defined Return Type**

You can't use the `Return</api/language/return>` statement with a variable, expression, or value to be returned in a method unless you define a data type for the value being returned in the function declaration.

No return data type defined in the method declaration:

``` xojo
Sub myMethod(a as Integer, b as Integer)
  Return a * b
End Sub
```

To return a value, declare the data type of the returned value. In that case, the declaration statement in this example would be:

``` xojo
Function myMethod(a as Integer, b as Integer) as Integer
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Cannot Use the New Operator with a Class Interface**

You used the `New</api/language/new>` operator with a class interface. You create new class interfaces using the Project . Add . Class Interface menu command or the Add Class Interface button in the Project Editor.

The class interface Interface1 has already been added to the project

``` xojo
Var c As Interface1
c = New Interface1
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Have Used an Operator that is not Compatible with the Data Types Specified**

You tried to perform an operation on data types that don't support the operation. For example, multiplying strings, dividing `Booleans</api/data_types/boolean>`, etc.

``` xojo
Var c As Integer
Var d, e As String
Var g, h As Boolean
d = "Ted"
e = "Alice"
c = d * e ' error
c = g / h ' error
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Must Indicate the Data Type of the Value to be Returned**

You declared an external function using the Function keyword but did not specify the return type. This happens because the data type of the value returned was left off or because the programmer intended to declare a sub but used function instead.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**You Must Use the Value Returned by this Function**

You called a function but did not assign the result to a variable or property.

If you want to call the function but ignore the result, use the `Call</api/language/call>` statement.

Trying to assign the result to an object rather than a property of the object:

``` xojo
CheckBox1 = True
```

Ignoring the result returned by a built-in function:

``` xojo
Atan2(1,0) ' not assigned to anything
Color.RGB(100,100,100) ' incorrect
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
