This Method or Property Does Not Exist

From Xojo Documentation

Revision as of 21:53, 12 November 2019 by PLefebvre (talk | contribs) (Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Error message

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 Action event handler of a PushButton; the user wants to display the caption property of the PushButton.

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 MenuItem, 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 caption property of the calling PushButton, but this is not permitted.

Function myCaption() As String
Return Me.Caption

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

See Also

Var statement.