Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
CtlName Property Details
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Usage Notes
■ By default, Visual Basic defines the name of a control (the CtlName
property) as the control type, plus a unique integer, starting at 1.
The numbers assigned are cumulative - for example, Option1, Option2,
Option3, and so on. This yields a unique naming scheme for each control.
■ Default control names are:
Control Default Control Default
══════════════ ════════ ════════════════════ ═══════════
Check box CheckN Combo box ComboN
Command button CommandN Directory list box DirN
Drive list box DriveN File list box FileN
Frame FrameN Horizontal scroll bar HScrollN
Label LabelN List box ListN
Menu MenuN Option button OptionN
Picture box PictureN Text box TextN
Timer TimerN Vertical scroll bar VscrollN
───────────────────────────────────────────────────────────────────────
■ To change the default, specify a unique name for the control. A valid
control name has the following characteristics:
• Must start with a letter
• Can include alphanumeric or underscore (_) characters
• Cannot exceed 40 characters
Note: Remember "control name" + "_" + "longest event name" must not
exceed 40 characters total.
■ A CtlName property cannot be a Visual Basic reserved word.
See: ◄Visual Basic Reserved Words►
■ To create a control array, specify the same CtlName property for each
control in the array. See: ◄Creating a Control Array►
■ You cannot refer to the CtlName property itself in code. If you need to
identify a control to be passed to a procedure, use the Tag property.
See: ◄Tag Property►
■ Changing the name of a control does not automatically change the name
of related event procedures. You may need to manually rename event
procedures to activate them for the renamed control.