Solved

Control limit on form

Posted on 1999-01-19
9
927 Views
Last Modified: 2013-11-13
I am getting a message box saying  "Reached limit: Cannot create any more controls for this form", I know I have alot of controls on this form, they are main in a tabbed control.  But I was wondering if there was a way to get around this?  Maybe a fix patch or something?
0
Comment
Question by:strongd
9 Comments
 

Expert Comment

by:HMWT
ID: 1469455
I can get abt 430 controls on a form before I get a out of memory error but I never get a too many controls error. it may be because I have most of my controls in arrays. this might make a diferance try putting all of your labels in 1 single array, or at least all the ones that will not need to be updated by code.
this may help.
0
 
LVL 3

Expert Comment

by:groone
ID: 1469456
I would have to agree.  Put them in a control array then unload and load them as necessary.  I am sure you dont need all those controls loaded at one time do you?

for instance you have 100 controls on tab1, when tab1 is selected

for i = 1 to 100
load label(i)
unload label(i+100)
next i

it's just a thought.  You can then use UBound to find out just how many controls you got Label.UBound
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1469457
Just in case you don't know - to create a control array just put a control on your form. Then, there is an "Index" property - set that to 0.

As soon as you've done that you can use groone's method to add as many copies of that control as you like.

Groone is right.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Expert Comment

by:VB6User
ID: 1469458
There is a Pathc for VB5 an VB6 that should solve this problem. Just go to the Miucrosoft Web site and get it.

0
 

Author Comment

by:strongd
ID: 1469459
I looked all over the site.  I didn't find any patch for VB 5 for this problem.  Point me to the link, I'll give you the points....
0
 
LVL 1

Expert Comment

by:rondeauj
ID: 1469460
create your own control that houses your other controls
0
 

Expert Comment

by:israelw
ID: 1469461
i think that you can use collections of controls and manage it for every tab separately.
0
 
LVL 2

Accepted Solution

by:
FlorisMK earned 10 total points
ID: 1469462
There is a simple solution, both controlcount-wise and performance-wise (one of the tips I always give at the end of Mastering VB5): design a group of controls, create an image (screen capture) of the group, use the image in stead of the controls, and write code to capture the mouseclicks and parse them; in effect, create an image map that looks like your controls. Disadvantages are many (your 'controls' will not assume Windows system colors anymore), but you will see a significant performance increase and not have the problem with too many controls anymore.
0
 

Author Comment

by:strongd
ID: 1469463
I'll go a head and try this...  Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question