Visual Basic 6.0 Project restrictions

Source: Internet
Author: User

A single project can contain up to 32,000 "identifiers" (non-reserved words), including (but not limited to) forms, controls, modules, variables, constants, processes, functions, and objects. note that the actual number of identifiers is limited by the available memory.
The variable names in Visual Basic are no more than 255 characters, while the form, control, module, and class names are no more than 40 characters. Visual Basic does not limit the actual number of different objects in the project.

◆ Control restrictions ◆
Each non-Graphic Control (all controls except shape, line, image, and label) uses a window. every window uses system resources, so the total number of Windows that can coexist is limited by available resources. the exact limit depends on the available system resources and the type of controls used. to reduce the consumption of system resources, you can use shape, line, label, and image controls instead of image box controls when creating or displaying images.
1. Total number of controls
The maximum number of controls allowed for a single form depends on the type of controls used and available system resources. however, each form allows a fixed limit of only 254 control names. because all controls in the array share the same control name, the control array only counts this restriction once. in all versions, the control array index is within the range of 0 to 32,767. if you place controls on the top layer of each control, for example, nested framework controls in the framework, Visual Basic generally only accepts nested controls of no more than 25 layers.
2. Restrictions on special controls
The following table lists the property restrictions for special controls in Visual Basic.
List and listcount list box controls and combo controls: the maximum number of items is 32 K, and the size of each item is limited to 1 K (1024 bytes );
Text text box control: up to 64 K;
Caption label control: limited to 1024 bytes;
Command button control, check box control, frame control, and Option Button Control: limited to 255 characters, any title that exceeds these restrictions is truncated;
Title of custom control property: limited to 32 K
Menu Control: limited to 235 characters
All tag controls: limited to available memory size
Name all controls: limited to 40 characters
Note: in Visual Basic, the control attribute name is limited to 30 characters.

◆ Code ◆
the code can be loaded to a form. The total number of codes of a class or standard module is limited to 65,534 lines. A line of code is limited to 1023 bytes. before a line of actual text, there can be a maximum of 256 leading spaces, and a maximum of 25 operators (_) can be contained in a logical line (_).
1. process, type, and variable
there is no limit on the number of processes in each module. each process can contain up to 64 KB of code. if the process or module exceeds this limit, Visual Basic produces a compilation time error. if such an error occurs, you can split a very large process into several smaller processes, or move the module-level declaration to another module to avoid such errors. visual Basic uses a table to save the identifier names (variables, processes, constants, etc.) in the code ). each table is limited to 64 K.
2. Dynamic Link Library declaration table
Each form and code module uses a table describing the structure of the dynamic link library entry point. each structure is about 40 bytes, and the table size is limited to 64 KB, forming about 1500 declarations for each module.
3. The project Table
the entire application Program uses a table containing all the names. these names include:
· constant name
· variable name
· custom type definition name
· Module name
· DLL Process Declaration name
there is no limit on the total size of the project table, however, the case-sensitive entries cannot exceed 32 KB. if the value exceeds the 32 K limit, you can re-use the private identifier in different modules to limit the number of case-sensitive entries to 32 K.
4. Input table
if each identifier is referenced in different modules, an entry is created in the input table. each entry contains a minimum of 24 bytes, but is limited to 64 KB, so that each module can have about 2000 references.
5. Module entry table
each module has a maximum of 125 bytes, but there is a limit of 64 KB. In this way, each project can generate about 400 modules.

◆ data restrictions ◆
The following restrictions apply to variables in Visual Basic.
1. Form, standard, and class module data
the VBA module data segment of any form or module in Visual Basic (that is, the data defined in the Declaration part) there is a data segment of up to 64 KB, which includes the following data:
· local variables declared using static
· not a module-level variable of arrays and variable-length strings
· each module array and variable-length string occupies 4 bytes
2, process, type, and variable
If the process or module exceeds the 64 K code limit, Visual Basic generates a compile-time error.
if the number of local variables defined in a process exceeds 64 KB, an error "too many local non-static variables" is returned.
If the module-level variables defined in a module exceed 64 K, or the custom type exceeds 64 K, an error "fixed or static data cannot exceed 64 K" is returned.
in case of such errors, you can split a large process into several smaller processes, or move the module-level declaration to another module to avoid such errors.
the array declared as a variable cannot use all array space. Only the array descriptor has a 64 K limit. for example, dim X (1000000) as byte. however, if a large, fixed-size array is declared in the record and the example of these records is declared as a variable, memory overflow will occur.
3. Custom type
although the total number of variable-length strings of many custom types can exceed 64 KB (each variable-length string of the custom type occupies only 4 bytes; the actual content of the string is stored separately) but the variable of the custom type cannot exceed 64 K. the custom type can be defined by other custom types, but the total size of this type cannot exceed 64 K.
4. Stack space
parameters and local variables during runtime occupy the stack space. module-level variables and static variables do not occupy the stack space because they are allocated in the Data Segment of the form or module. the stack must be used for execution of any called DLL process.
Visual Basic also uses the stack. For example, it saves the intermediate value when calculating the expression.
the size of all available visual basic Stacks is 1 MB per Thread ). however, if there is adjacent idle memory, the size of the stack can exceed this limit.

◆ System resource restrictions ◆
Some restrictions on Visual Basic and Applications created with it are affected by Microsoft Windows. These restrictions may vary with Microsoft Windows versions.
System resources must be used for each opened window (Data zone used by Microsoft Windows ). if the system resource range is exceeded, a running error occurs ". you can select "about" from the "program manager" or "File Manager" help "menu in Windows NT 3.51 ", you can also select "about" from the "Windows Resource Manager Help" menu of Windows 95 and Windows NT 4.0 to check the percentage of remaining system resources. applications can also call the Windows API getfreesystemresources to recycle system resources and close windows (for example, open windows and "code" windows, and windows in other applications) and exit the running application.

Girl does not cry (QQ: 191035066) @ cnblogs @ 11:49:01
Http://www.cnblogs.com/nbsofer/archive/2011/12/29/2305861.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.