Solved

Memory shortage problem with VB 5.0. Help! Help!!

Posted on 1998-10-30
3
242 Views
Last Modified: 2010-04-30
Hi, All:

I am having a serious problem with VB 5.0, please help!

There are one SSTab control that contains 10 tabs, and 3 dialog boxes in my project.
The SSTab and 3 dialog boxes contain total approximately over 800 controls that are put in various arrays of controls (text box, combo box,check box, list box, command button, option button).  Also, the project contains 5 file
modules.

when this project is opened, I got a message says "Out of Memory". I couldn't run it and do anything on it.

In my computer, the RAM' capacity is 84 MB. I checked resource meter in system tools (Windows98). Before opening the project, System free memory is 85%, User free memory is 85%, and GDI is 86%. However, as soon as my project is opened and the forms are loaded, the System free memory is only 7%, User free memory is 7% and GDI free memory is 85%. A warning message shows ou and says that " more than 90% of resources has been using and the project should be terminated.  It is not enough to support rest of my work on the project.

I believe there must be some ways to avoid such situation, but I have no idea about it.

Could anybody give me a hint to solve this problem?

Thank you in advance!

Jay
0
Comment
Question by:jayLi
3 Comments
 
LVL 14

Accepted Solution

by:
waty earned 100 total points
ID: 1442539
See the help below :

Total Number of Controls
The maximum number of controls allowed on a single form depends on the type of controls used and available system resources. However, there is a fixed limit of 254 control names per form. A control array counts only once toward this limit because all the controls in the array share a single control name.
The limit on control array indexes is 0 to 32,767 on all versions.
If you layer controls on top of each other, such as using several frame controls within other frames, Visual Basic will accept no more than six levels of nested controls.
Limitations for Particular Controls
The following table lists property limitations that apply to particular controls in Visual Basic.
Property      Applies to      Limitation

List and ListCount      List box and combo box controls      Maximum number of items is 32K; the  limit on the size of each item is 1K (1024 bytes).
Text      Text box control      Limited to 64K.
Caption      Label control      Limited to 1024 bytes.
      Command button, check box, frame, and option button controls      Limited to 255 characters. Any caption over these limits is truncated. Captions on custom control properties are limited to 32K.
      Menu control      Limited to 235 characters.
Tag      All controls      Limited only by available memory.
Name      All controls      Limited to 40 characters.
      
Note   In Visual Basic, control property names are limited to 30 characters.
      

0
 
LVL 12

Expert Comment

by:mark2150
ID: 1442540
You need to partition that puppy up into several forms and only load them as required in memory. If you start with a module level call you can throw your forms on the screen one at a time and unload them when done.

I'd hate to see what your screens look like!

Your SSTAB control is wayyyyyyy overloaded. Perhaps you can restructure your code to be a little more elegant with it's use of controls? Maybe reuse some of them? Certainly you're not putting 800 controls on the screen at *once*? (If you *ARE*, then there is definately room for improvement!)

Use combo and list boxes instead of lines of text boxes, etc. Can't say too much more without seeing the structure, but there surely is a way to cut down on the clutter.

M

0
 

Author Comment

by:jayLi
ID: 1442541
Thank you for your help.

I think what Mark2150 said is more useful for solving my problem.

What I would like to know  after getting both your answer is that IS THERE ANY way to reduce memory consuming.

Mark2150 suggested reducing number of controls. That's a good idea. If I MUST have so many controls in my one form, is there a way to increase memory setting (in Windows95/98, or VB environment) for my project?

Thank you again.

JAY  
0

Featured Post

Industry Leaders: 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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

685 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