PDA

Click to See Complete Forum and Search --> : memory errors with user controls


uk-Canuck
Sep 21st, 2001, 07:03 AM
Does anyone know of any problems with using nested user controls in VB

I have written an app that creates a type of grid control from an array of user controls and use it on the main form of my app, however it seems to crash on a regular basis when i load about 50+ rows into the grid control

Anybody have any ideas
:confused:

jim mcnamara
Sep 22nd, 2001, 05:36 PM
If this is a VB app and ActiveX control, you've got a resource problem. You're requiring more memory than the the virtual system can have resident.



c-style cast (This is a general statement) VB uses a lot of memory to create one usercontrol, copies use less.

50+ controls plus a container control could easily use 75 meg. Windows 98 takes 32 meg - other versions at least the same. So, unless the system running this has 128+ MB of memory, the control cannot exist, because at least part of it will be in the page file. For any control to work, all of it's components have to be memory-resident.



You can find free/inexpensive grid controls at places like www.planetsourecode.com. You can also have the textbox component of the grid as a separate COM object, written in C++.
That will drop it's memory cost by a factor of five.

Goto www.codeguru.com and look for edit box control samples.