Solved

Any ideas? Alternate SSTab Controls Approach, Limit reached Error: "Reached limit, cannot create any more controls on this form.

Posted on 2006-06-21
7
320 Views
Last Modified: 2011-09-20
I am looking for ideas.  I have a form called 'frmDescirption' in my VB6.0 app that uses SSTabs extensively.  The form has six main tabs: Cover, Main, Timeline, Levels, Implications and Evaluations.  The data associated with five of the six tabs can be entered in an area the fits comfortably within the alloted space.  None of these are an issue.

My question relates to the 'Levels' tab.  The users are  permitted to enter up to 15 levels for each analysis that they are doing, so the fifth tab, 'Levels' contains another SSTab strip with 15 tabs, one tab for each possible level that can be entrered by the user.  Each of these level contains exactly the same informaton and I use control arrays so that the field names are the same on each of the 15 tabs/levels and I reference specific fields on specific levels by using an index.  I also have the data for each of the 15 tabs stored in memory arrays.  I have always been aware that this is not the most memory efficient way of handling the multiple occurences but have never addressed it, however now I must.  The number of fields needed to collect the information associated with each 'Level' has increased to the point that I have reached VB's limit. When I try to add a new control to the form I get an error message 'Reached Limit: Cannot create any more controls on this form'.

I know I must adapt an alternate way of handling the 15 levels but I want the usability to remain the same.  Using the 15 identical tabs gives the user great flexibility and speed (one click) in jumping from level to level and main tab to main tab.  They can jump from level 10 on the 'Levels' tab to the 'Cover' tab with one click.  I know it would be more efficient to only have the 'Level' screen defined once and shuffle the data of the related level to and from that single screen/form but I don't want to lose the navigational flexibility of the quick, one click  jump from level to level and main form tab to main form tab.  I considered having a seperate stand alone form that I could invoke each time they wanted to view or edit a particular 'Level'.  However, I would have to pass the data needed to populate the form and retreive it and edit it.  Some of the edits involve interdependancies between levels, so I need the data from all 15 levels to edit the data just entered by the user.

I also thought of keeping the 15 tab SSTab control on the form but not creating any specific forms under it.  I would then use the click event of the tab to 'popup' the form for the clicked level.  This seems like a good idea but I don't quit know how to do it.  Where would I define his popup form in the 'frmDescription' definition.

More information: This is not a bound form.  The data is retrieved from the database and populated to the pertinent objects on the form.  when entry is complete, the data is reteived from the form and written to the pertinent tables in the database.
0
Comment
Question by:mlcktmguy
  • 4
  • 3
7 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 16956333
Hi mlcktmguy,

The first thing that comes to mind is to use control arrays but you are already using them. Are you sure that all labels, even those that are not in the Levels tab, are set in a control array?

The other thing would be to create a user control that contains all the controls required in your sub-tabs of level.

Cheers!
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 16956365
I appreciate your quick response but I need more detail than that, especially for 500 points.  I tried to explain my situation as completely as possible.  I understand the concept of container controls.  Where would I put this container on the form and I how would I trigger making it active/visible.
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 16956382
mlcktmguy,

If you create a custom user control (or a container control), you could add all the controls that a level requires and you can then add 1 instance of this new control to each of your 15 tabs. This way, there is no need to show/hide containers. It would also count as only 1 control if you put these 15 instances in a control array.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Author Comment

by:mlcktmguy
ID: 16956434
Once again thanks for the quick response.  I think I have done what you are suggesting but possibly not.  I'll explain what I have done to build the forms to this point, please tell me where I went astray.  Up until trying to add some new objects to the form today, everything worked fine.  This aop has been in production for over a year.

On tab 1 of the 15 SSTab 'level' tabs I placed a PictureBox equal to the size available on the tab.  On top of the PictureBox I placed an Image equal to the size of the picturebox.  On top of the Image I put all of my label, textbox and button controls.  There are about 50 of these controls on each level.  I then copied all of this to the next 14 tabs.  All of the controls are control arrays.  The picturbox on tab 1 is occurrence 0, the image on tab 1 is occurrence 0, all of the buttons. labels and texboxes on tab 1 are occurrence 0.

Is this what you meant to do?

The image is loaded with a graphic at runtime which serves as a unifrom background.
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 16956456
mlcktmguy,
> There are about 50 of these controls on each level.

Create a USER CONTROL that will contain these 50 controls. Not simply a container control like a picture box.

From the Project menu, select "Add user control".

0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 16956659
Thanks again for your response.  I have never used a User Control so I have a few questions.  I pretty sure on some of these but I'll ask them anyway.

Do I put the picture and image on the USER CONTROL first or do I just put the labels, buttons and textboxes.

Once I create the user control how will I get it on my form?  Will it appear in my 'Tools' selections along with Labels, Texboxes, Buttons, etc..  

Do I put the user control on every tab of my levels or do I put it on the first tab and then copy it ffrom the first tab to all of the others.

How do I reference the objects on the USER CONTROL in my VB program.  In my current set up I simply refer to the object name with an index (for example: LevelDescription(Index)).

I may have more questions as I proceed.

I really apprecaite your help.
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 16956789
>>Do I put the picture and image on the USER CONTROL first or do I just put the labels, buttons and textboxes.

You can put almost any control you want. There are some that you cannot (like the OLE control).


>>Once I create the user control how will I get it on my form?  Will it appear in my 'Tools' selections along with Labels, Texboxes, Buttons, etc..  

Close the designer of your control and your control is right in your toolbox. Drop one on your form just like you do for regular controls.

>>Do I put the user control on every tab of my levels or do I put it on the first tab and then copy it ffrom the first tab to all of the others.

It behaves like a standard control. So if you put one on the first tab and copy it to all others, you will be ask if you want to create a control array. It is up to you to say Yes or No.

>>How do I reference the objects on the USER CONTROL in my VB program.  In my current set up I simply refer to the object name with an index (for example: LevelDescription(Index)).

You will need to create Public Properties in your control that will read/write the Text property of your textbox.

It is now time for you to learn how to create a UserControl. Read this section of the help file: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconolecontrolcreationbasics.asp
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now