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 keyword in a parameter list containing the ParamArray keyword.


A ParamArray cannot be Passed by Reference

You tried to declare a parameter using both the ParamArray and ByRef keywords. Parameters declared as ParamArray cannot be passed by reference.

This invalid parameter declaration causes this error:

ParamArray ByRef a() As Integer

A ParamArray cannot have a Default Value

When you declared a parameter using the ParamArray keyword, you gave it a default value. This is not valid.

The following method declaration is not valid:

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 keyword with an array parameter in a method declaration.

This method declaration uses the 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 OR by passing an array to the method. You cannot use both techniques at once.

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 but also tried to assign it a default value.

The following parameter declaration is not allowed

ByRef a As Integer = 5

You can either remove the ByRef keyword or remove the default value assignment.


A Var Statement creates only one new object at a time

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

Note

This error and the explanation of it applies to the Dim statement as well.

The following statement produces this error:

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.

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

Using separate Dim statements:

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 keyword. This is not valid.

The following method declaration is not permitted.

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

The following parameter declaration is not acceptable.

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. This is not allowed. Pass only the parameter declared as ParamArray.

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

Sub myMethod(ParamArray n as Integer, m as Integer)

Array Bounds must be Integers

You used a non-integer in a Var statement when trying to declare an array. You can use Integer constants to dimension an array, but not non-integers.

Var aPicture (5.2) as String
Var aProps (True) as Boolean

Assigns can only be used on the last parameter

You used the 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 keyword for the first parameter, causing this error:

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:

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:

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". 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 passed to the MessageDialog command:

MessageBox("Hello world)

Exception Objects Must be of Type RuntimeException

You declared an exception variable as something other than a RuntimeException or a subclass of RuntimeException.

The following declaration produces this error:

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:

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 keyword more than once and/or on a parameter other than the first parameter.

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

Should be rewritten as:

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

External Functions Cannot Use Objects as Parameters

This error occurs if you Declare an external function and try to specify that one of its parameters is an object.

When passing a MemoryBlock to a Declare, use Ptr instead. When passing a window to a Declare, use WindowPtr instead.


External Functions Cannot Use String Data Types as Parameters

Occurs if one of your Declare statement's parameters is an standard string. Use CString or PString instead.


GoTo Target Not Found

You used a label in a GoTo statement that is not used in the method. Therefore, the jump could not be executed.

The example from the GoTo keyword is modified so that there is no code that is identified by the label used in the GoTo statement.

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 or an expression that did not evaluate to a Boolean where a 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.

See Also Self, Me keywords.


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 constants can be used with #If...#Endif statements.

A 'regular' Boolean variable cannot be used as shown here.

Var b As Boolean
b = True
#If b Then
  System.Beep
#Endif

Only One Parameter may use the Assigns Option

You used the Assigns keyword with more than one parameter. You can use Assigns with only one parameter and it must be the last parameter.

The following method declaration uses Assigns twice.

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 keyword. You can pass only one parameter that uses the ParamArray keyword. If there is more than one parameter, the ParamArray keyword should be used for the last parameter.

The following method declaration uses the ParamArray keyword twice.

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 keyword for any parameter other than the first parameter.


Only the Last Parameter may use the Assigns Option

You used the Assigns keyword with any parameter other than the last parameter. The Assigns keyword can only be used for one parameter and it must be the last parameter.

The following method declaration uses the Assigns keyword for the first parameter.

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:

s As String = 15

Since s is declared as a String, its default value must be a String. 15 isn't


Parameters are not Compatible with this Function

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

The Color function expects integer values:

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 or 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:

If (d > 0 Then
.
End If

An incorrect Var statement:

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 statement:

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

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 statement:

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 statement (conditional compilation).

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 loop:

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:

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 loop:

While I < 10
  System.Beep
Next //should be Wend

Omitting the While statement:

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

The Loop keyword is missing from a Do statement:

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 statement

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

The End Select keyword is missing from a Select Case statement:

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 statement is missing:

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

The Sub and Function statements cannot appear inside a method.

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:

ListBox1.AddRowAt(2,)

Using an equals sign when it is not necessary:

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

A keyword was misspelled:

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 statement:

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 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 loop, the counter variable is i, so the variable on the Next statement must also be i:

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 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 method to add elements, such as:

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

Trying to size an array using a variable:

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 condition in an If statement. To eliminate the possibility of this error, type Shift+Enter after typing

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.

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

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

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.

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:

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 statement:

Var aInts(3) As Integer
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.

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 method with a two-dimensional array.

Var aTest(3,3) as String
Var i,j as Integer
For i=0 to 3
For j=0 to 3
aTest(i,j)=Str(i)+Str(j)
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 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

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

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

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 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 objects cannot be sorted, but an array of SecondsFrom1970 properties of DateTime objects can be sorted, since the SecondsFrom1970 property is a Double.

This example array cannot be sorted.

Var d(2) as DateTime
d(0)=New DateTime(1965, 1, 1)
d(1)=New DateTime(1970, 1, 1)
d(2)=New DateTime(1950, 1, 1)
d.Sort

The last line of this example produces the error message.

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 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 statement or a parameter declaration.

Reusing the name of a constant in a local variable.

Const PI = 3.14
Var PI As Double
pi = 3.1416

Reusing the name of a parameter as a constant:

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

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

ListBox1.AddRow  2 "Chicago"

Passing too many parameters:

listBox1.insertRow 2,"Charlie","Dallas"

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

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

ListBox1.insertRow  2 "Chicago"

Passing too few parameters:

ListBox1.insertRow "Chicago"
Var c as Color
c=RGB(100,100) //returns "RGB takes 3 parameters"t

In the following examples, myFunction takes two parameters and returns a Double:

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:

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

Assigning a value to a variable that has not been declared using a Var statement

i = 10

This is the Pressed event handler of a DesktopButton; the user wants to display the caption property of the DesktopButton.

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, but the Bold property is not recognized in code:

SearchFind.Bold = True

Using 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, but this is not permitted.

Function myText() As String
Return Me.Text

You can only access the calling object's properties using Me within an event handler belonging to that object.

The programmer intended to declare aNames as an array in the Var statement but forgot to do so.

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:

myPrivateProperty = 56

This Name is Already in Use

You used a variable name in a Var statement that has already been declared in another Var statement or as a property. Or, you tried to declare a property with the same name as another property.

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

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

The If statement in this example should be #If...#Endif.

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.

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.

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:

Class SomeSuper
    Property SomeProperty As Integer
End Class

Class SomeSub
Inherits SomeSuper
    Property SomeProperty As String
End Class

Type Mismatch

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 to an Integer variable:

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.

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

#Pragma myGreatPragma

You Can Only Inherit From a Class

Occurs only in 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 statement and loop through all the values of the array index.

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 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 in the called method.

The following method takes one parameter that was declared as ByRef:

Sub Squarit(ByRef c as Double)
c=c*c

The calling function is:

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 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 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 or SocketCore.

Don't do this:

Var w as DesktopWindow
w = New DesktopWindow

Instead, use the 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.

Var w as FindWindow
w=New FindWindow

You Cannot Implement a Nonexistent Event

Occurs only in 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 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:

Sub myMethod(a as Integer, b as Integer)
Return a*b

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

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

You Cannot Use the New Operator with a Class Interface

You used the 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

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, etc.

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

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

CheckBox1=True

Ignoring the result returned by a built-in function:

 Atan2(1,0) //not assigned to anything
Color.RGB(100,100,100) //incorrect