共用方式為


Name Property

Specifies the name used to reference an object in code. Available at design time; read-write at run time.

Object.Name[ = cName]

Property Values

  • cName
    Specifies the name used to reference the object in code.

Remarks

The default name for new objects is the type of object plus a unique integer. For example, the first new Form object is Form1, and the third text box you create on a Form is Text3.

Note   If the object is the first object in the object hierarchy (that is, the outermost container object), use the object variable to reference the object instead of the Name property.

For a Project object, the Name property contains the name and path to the project, and is read-only at design time and run time.

For a File object, the Name property contains the name and path to the file, and is read-only at design time and run time.

See Also

Caption Property | NewIndex Property | NewItemID Property | ServerName Property | TypeLibName Property

Applies To: ActiveDoc Object | CheckBox | Column | ComboBox | CommandButton | CommandGroup | Container Object | Control Object | Cursor | Custom | DataEnvironment | EditBox | File Object | Form | FormSet | Grid | Header | Image | Label | Line | ListBox | OLE Bound Control | OLE Container Control | OptionButton | OptionGroup | Page | PageFrame | Project Object | ProjectHook Object | Relation | _SCREEN | Session Object | Shape | Spinner | TextBox | Timer | ToolBar