Maximum Length of Name Property Depends on Events Supported

Last reviewed: June 21, 1995
Article ID: Q96151
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, versions 2.0 and 3.0
- Microsoft Visual Basic programming system for Windows, version 1.0

SUMMARY

The maximum length of the Name (CtlName in version 1.0) property for controls varies from control to control depending on the character length of its longest event name. Event procedures names are limited to a length of 40 characters including the control's Name property, the underscore, and the event name. Therefore, the longer the event name, the shorter the Name property can be.

In Visual Basic versions 2.0 and 3.0, the Label, Picture Box, and Text Box controls add support for the LinkNotify event, which is one character longer than any event supported in version 1.0 for these controls. The maximum length of the Name property for these controls is therefore one character fewer in versions 2.0 and 3.0. A table showing the maximum length of the Name property for all of the standard controls in Visual Basic versions 2.0 and 3.0 is listed below.

MORE INFORMATION

The Name property of forms are not dependent on the events supported because the property is not used in the name of form event procedures. Event procedures for forms all begin with Form and therefore can be up to the 40-character maximum in length.

Maximum length of Name properties for Version 2.0 and 3.0 controls

Control              Name Length Limit
Check Box                  30
Combo Box                  30
Command Button             30
Directory List Box         30
Drive List Box             30
File List Box              26
Frame                      31
Grid                       27
Image                      30
Label                      29
Line                       39
List Box                   30
Menu                       34
OLE Client                 30
Option Button              30
Picture Box                25
Scroll Bars                30
Shape                      39
Text Box                   29
Timer                      34


Additional reference words: 2.00 3.00
KBCategory: kbprg
KBSubcategory: PrgCtrlsCus


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.