Solved

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

Posted on 1998-10-30
3
237 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 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

7 Experts available now in Live!

Get 1:1 Help Now