Solved

Runtime error #7 - out of memory

Posted on 2001-06-06
14
2,014 Views
Last Modified: 2008-03-03
I've developed a Visual Basic 6.0 program that displays some data (gathered from a Access database throw ODBC). This program works fine in my computer, under Windows 2000 but in eveery other computer with Windows 9x shows a runtime error #7 "Out of memory".
Please help!!
thanks a lot

p.s. even in my own computer with windows 98 and the very same software installed gets the #7 error.
0
Comment
Question by:krahd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +5
14 Comments
 
LVL 8

Expert Comment

by:AJAY CHADHA
ID: 6162654
Increase the virtual memnory size and make sure that you have installed the latest service pack i.e. SP5

Good Luck...
Ajay Chadha ... :-)
0
 
LVL 18

Expert Comment

by:deighton
ID: 6163008
Do you create any large arrays, strings or collections in your program?  

Use error handling code to check what it is doing when it runs out of memory.  

Don't hold huge amounts of data in memory.
0
 
LVL 1

Expert Comment

by:morgan_peat
ID: 6163015
Are you getting back loads of data?
Your machine should basically have the same amount of memory as hard disk+RAM.
When running in Win2K, try using the performance monitor to make sure you haven't got a memory leak somewhere.
Check Process->Private Bytes->Your running app.
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6163936
Usually when I get this error, it's because of an infinite loop or infinite recursion problem.  Does it happen at design time as well?  If so, bung in a couple of break points or click ctrl-break and see what's happening...
0
 

Author Comment

by:krahd
ID: 6165179
Thank you all for your comments.
What I have is a form named fMainForm with a lot of controls in it.
I have 400+ textboxes and 200+comboboxes, divided in 11 "pages" using frames and a TabStrip (by toggling the visible propertie of the frames).
I have also, 6 forms that access some other data using dataGrids.
The program checks the database and fills the controls fMainForm up.
Then the user is allowed to make some changes, but when he tries to save them he gets the #7 error.
The amount if data involved is not really big, just what is needed to fill the controls up.
Every procedure I used is far smaller than 64kb, but the "text size" of fMainForm is 437 kb (300 just due controls declarations).
I do not have infinite loops, and the biggest collection I have has less than 60 objects.
Anyway, what I cannot explain is: why do I get the error udner windows 9x & ME but it does NOT appear under Windows 2000?

Thanks a lot again.
krahd
0
 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6165885
You might be running out of system resources, with that many controls on a form.  I *think* in Win95 there's still a limit, it was just increased.

Are you using control arrays for the multiple text boxes and combo boxes?
0
 

Author Comment

by:krahd
ID: 6166516
Hi again.
I'm using control arrays for both text and combo boxes.
I use one array for each type of control for each page. Id est I have 22 arrays (11 per type).

I forgot to mention that there are a lot of labels too, one per control (describing the info contained) Arranged in one array per page, too.

Thanks again.
Krahd.

P.S. Could it be a bug in ADO software?
0
 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6166526
I'd be checking system resources, then.  Run sysinfo and have a look...
0
 
LVL 1

Expert Comment

by:morgan_peat
ID: 6166894
Theres a good knowledge base article about this: Q229756
(http://support.microsoft.com/support/kb/articles/Q229/7/56.ASP)

I quote:
"Although you can have up to 254 control names in a form ... In some cases, you will experience out-of-memory error. ".


It also explains a few ways to get around it (i.e. UserControls, control arrays).
Best way is to try and cut down the size of your forms though.....
0
 

Accepted Solution

by:
bosley earned 300 total points
ID: 6181748
Hi krahd, we have just gone through the exact same problem on our project.  I had a form with a grid and 2 tab controls.  The main tab control had 8 tabs and about 50-60 controls on it.  We found we had to break this form up. When this form was loaded our Win 95 systems took over a 25% resource hit (looking at the resource monitor).  what we did was to break up each of the tabs to a sub-form that is loaded on the click of a button from the main form (fMainForm).  So instead of 8 tabs we have 8 buttons. From the user's point of view they either have to click on the tab they want (old version) or a button (new version).  This reduced the resource hit from 25% to about 5%.  Your case may be a lot more of a savings because you have more controls than we did.

Just a suggestion.

bosley

0
 

Author Comment

by:krahd
ID: 6185125
Hi again.
First af all I would like to give thanks to all who took the time to answer. Thans :)

Bosley: As far as I remember the subform (a la Access) feature isn't present in Visual Basic...
but if it is, could you please tell me how to do it? :)

(I've made a prototype where another form was loaded by frmMain (but not a subform) but it was rejected...)

Thanks again,
   Krahd.



0
 

Expert Comment

by:bosley
ID: 6186045
krahd,

You create a forms (nothing special about the forms I just call them "sub forms") that contains the controls from your tabs. Next, you replace your tab control with, for example, buttons.  Each button corresponding to one tab on the tab control you removed. In the click event of the buttons on the main form you will open the corresponding form containing the controls previously on your tab:

private sub button1_click()
   form2.show
end sub

You can also use "form2.show vbModal" if you want the user to complete that form and close it (I assume this would trigger a save) before continuing with other processing on your main form.

I would suggest that each "sub form" corresponds to one table of data to make the inserts and updates, etc a lot more straight forward.

Hope this helps.

bosley
0
 
LVL 2

Expert Comment

by:JanusFury
ID: 6697706
Using that many controls is sure to cause your problem. I suggest using a static number of text boxes, and having them visible no matter what tab is chosen... then change the appearance of them to reflect the chosen tab.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6909577
Force-accepted by
Netminder
CS Moderator
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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

752 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