Click to See Complete Forum and Search --> : quantity of controls


elporti
October 22nd, 2001, 02:01 PM
I was wondering if there is a way to modify the number of controls that can be used in a form. I reached the top of 252 and cannot enter one more. Can someone help me?

thanks
elporti

Iouri
October 22nd, 2001, 03:21 PM
Each nongraphical control (all the controls except shape, line, image, and label) uses a window. Each
window uses system resources, limiting the total number of windows that can exist at one time. The exact
limit depends on the available system resources and the type of controls used.

To reduce consumption of system resources, use the shape, line, label, and image controls instead of picture
box controls to create or display graphics.

Total Number of Controls
The maximum number of controls allowed on a single form depends on the type of controls used and available
system resources. However, there is a fixed limit of 254 control names per form.
---------------------------------
A control array counts only
once toward this limit because all the controls in the array share a single control name.
---------------------------------

The limit on control array indexes is 0 to 32,767 on all versions.

If you layer controls on top of each other, such as using several frame controls within other frames,
Visual Basic will generally accept no more than 25 levels of nested controls.

Limitations for Particular Controls
The following table lists property limitations that apply to particular controls in Visual Basic.

Property Applies to Limitation
List and ListCount List box and combo box controls Maximum number of items is 32K; the limit on the size
of each item is 1K (1024 bytes).

Text Text box control Limited to 64K.

Caption Label control Limited to 1024 bytes.

Command button, check box, frame, and option button controls Limited to 255 characters. Any caption
over these limits is truncated. Captions on custom control properties are limited to 32K.

Menu control Limited to 235 characters.

Tag All controls Limited only by available memory.

Name All controls Limited to 40 characters.



Iouri Boutchkine
iouri@hotsheet.com

elporti
October 23rd, 2001, 06:21 AM
Thank you Iouri. your answer was very illustrative. If I cannot avoid the problem I must search for another way to do the same. I was using the shape form to represent each tooth in a odontogram where you can see 52 teeth (32 for adult and 20 for child) each having 5 faces. Do you have another way to represent them. remember that each part can display information independently of the other 4 faces.

thanks again
enrique

Iouri
October 23rd, 2001, 10:38 AM
Did you try to use control array? It uses less memory. 1 array is like 1 control

Iouri Boutchkine
iouri@hotsheet.com

elporti
October 23rd, 2001, 11:45 AM
I never used control array. How do you use it?

Iouri
October 23rd, 2001, 12:40 PM
Add a Textbox to the form. Call it Text1. Set index property = 0. Copy this text box and paste it to the form. On the prompt 'Do you want to create an array' answer yes. You will have 2 text boxes Text1(0) and Text1(1). This will be an arry with 2 elements 0 and 1. Continue this and you can create as many elemnts of the array as you want. The whole array will occupy memory like 1 textbox.

Iouri Boutchkine
iouri@hotsheet.com