Name Property

Returns the identifier name of the object.

Syntax

[ sName = ] Object.Name

The Name property syntax has the following parts:

 

Name

Type

Description

Object

Object

An object

sName

BString

A text string used to identify the control.

Comments

The default name for new objects is the kind of object (sometimes using abbreviations) plus a unique integer. For example, the first new Form object is Form1, a new ACheckBox1 object is chk1, and the third TextBox control you create on a form is txt3.

An object's Name property must start with either an underscore or a letter (either uppercase "A-Z" or lowercase "a-z"). Subsequent characters can be letters, numbers (0-9), or underscore ("_") characters, but can't include punctuation or spaces. The name can be of any length, but it best to keep it as short as is needed for clear understanding of its purpose.

Forms can't have the same name as another public object such as Clipboard, Screen, or App. Although the Name property setting can be a keyword, property name, or the name of another object, this can create conflicts in the programming code. Two controls of different types cannot share the same name.

Example

The following statement returns the ACheckBox Name:

schk1Name = chk1.Name

Applies to

All controls and most classes.

See Also

Caption, Description, Tag, Text, Variable Naming Conventions