Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Input past end of file vbs script 9 81
Adding to a VBA? 6 61
vb6 connector to SQL Server 2 34
Visual Studio search word table and return Cell index 8 48
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 …
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…

910 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

22 Experts available now in Live!

Get 1:1 Help Now