Maximum number of controls in a form

M

M

There are a maximum number of controls can be put in a form for VB3 to VB6.
The BOL of VBNET do not say VBNET also has this limitation.

Because the clients want add more functions from time to time.
I find one of the form reach the maximum number of controls.
If I add one more control in this form, the program will get error at
InitializeComponent.

Are anyone find similar situation

Thanks
 
V

vbnetdev

you are only limited by the amount of available memory or 32K child
controls, whichever is less.
 
H

Herfried K. Wagner [MVP]

M said:
There are a maximum number of controls can be put in a form for VB3 to
VB6.
The BOL of VBNET do not say VBNET also has this limitation.

Basically there is no such strict limit as in VB6. However, the number of
controls on a form is limited by memory and other factors.
Because the clients want add more functions from time to time.
I find one of the form reach the maximum number of controls.
If I add one more control in this form, the program will get error at
InitializeComponent.

What's the exact error message? Maybe it's time to refactor the user
interface and split up the huge form.
 
C

Cor Ligthert [MVP]

M,

We did some years ago a test in this newsgroup about how many controls where
possible.

The used number was so high that it would never be possible to put those in
a reasonable way on a form.

I hope this helps,

Cor
 
M

M

Thanks.
But where do you find the 32K.
There are thousands controls in the form but I believed no reach 32K
 
H

Herfried K. Wagner [MVP]

M said:
But where do you find the 32K.
There are thousands controls in the form but I believed no reach 32K

Really bad. I am wondering which controls you are using on the form. Maybe
some static controls such as labels and pictureboxes can be replaced by
drawing the text onto the form directly in its overridden 'OnPaint' method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top