VB 6: How many controls can be used in one form?

I know that the restriction for named controls is 254, in addition, you must use control arrays. But it seems that we too have reached the limit for arrays. Any idea what the absolute limit is?

+6
vb6
source share
2 answers

There is no absolute limit. If you place enough controls on the form, you will end up running out of memory. I made a test application that loads command buttons into a control array. My first launch crashed with an "Out of memory" error of about 6900 buttons. I closed several other applications and was able to download almost 8,200. I did the same with the text fields and got different results (about 7300 before and 8600 after). Different controls consume different amounts of memory, so there is no way to specify the exact number of controls that you can put on a form.

+7
source share

We have a record management system written in VB6, and we have a user interface guide that says that each record should have only one data entry form associated with it (i.e., it cannot open other windows). As a result of this policy, one of the more complex record types in our system now has a form with a total of 659 individual controls. We came across a limitation of 256 named controls, and then we converted many controls to manage arrays over time. We recently squeezed a room for 5 or 6 new controls, going through the whole form and transforming the few remaining standalone controls for managing arrays.

This is one time I would like to break the rules, but it will require quite a lot of refactoring to use a multi-form approach.

In any case, you can put at least 659 controls on the form, but I could never find out what the true absolute limit is (and I'm not sure what I want).

+1
source share

All Articles