Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB6 control limit error deleted all menus

Posted on 2012-12-31
5
Medium Priority
?
565 Views
Last Modified: 2013-01-06
I tried to add 4 menu items and on OK it gave me the error that I had reached the form's control limit and that I needed to delete some controls.  So I hit Cancel to undo the menu changes.  

However on Run I got errors... turns out all the menus are gone... not just the changes I made.

How do I recover????
0
Comment
Question by:torrid333
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 49

Assisted Solution

by:Martin Liss
Martin Liss earned 1000 total points
ID: 38733714
Unless you have backed up, you don't unfortunately.

You may be aware of this but if this is VB6 then you can get around the 256 (255?) control limit by changing individual controls into control arrays. Start with un-referred to labels as they are the easiest.
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 38733716
I should have said above that control arrays count as just one control as far as the limit goes. Also I would think that the code, if any, for the menu items would still be there.
0
 
LVL 15

Accepted Solution

by:
eemit earned 1000 total points
ID: 38738531
There is a fixed limit of 254 control names per form
Here are three ways to work around the control name and system resource limitations:

Use a control array - instead of using several instances of a control in a form, create a control array for all the similar controls on the form. Members of a control array share the same control name.

Dynamically create the controls as required - instead of loading all the controls on a form when you first display the form, try loading the controls as needed.

Put your controls on a UserControl - similar to using a control array, you can create a UserControl that contains your controls and then add the UserControl to your project. For example, if you need a form that displays 500 text boxes, create a UserControl that contains 250 text boxes, and put two instances of your UserControl on the form. You now have 500 text boxes on the form, but only two controls.

References
http://support.microsoft.com/kb/229756/en-us
0
 

Author Closing Comment

by:torrid333
ID: 38745082
I recovered from a backup file using a tool called winmerge which lets you compare two files side by side... kind of like diff in unix.

I will have to work on changing some stuff to control arrays but for now just wanted to recover back to where I was....
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 38745194
You're welcome and I'm glad I was able to help. The same thing happened to me along time ago in a place far, far, away.

Marty - MVP 2009 to 2012
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

704 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