Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB6 control limit error deleted all menus

Posted on 2012-12-31
5
Medium Priority
?
570 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
  • 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
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

926 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