Solved

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

Posted on 1998-10-30
3
239 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

809 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