Click to See Complete Forum and Search --> : Limitatins of controls/forms in vb6


Meera K
August 3rd, 1999, 03:56 AM
Is there any limitation on the number of forms/controls being used in a project in VB6?

I feel it is not so , but i'm unable to attach a grid to the data control in my project ?

IN the project ,I have around 180 forms and 4 modules . The report has been written in FORMULA ONE SPREAD SHEET CONTROL and hence each report needs to be in a separate form and this accounts for about 50 forms.

Can someone help?

Regards
K Meera








--------------------------------------------------------------------------------
Contact: webmaster@codeguru.com
© Copyright 1997-1999 CodeGuru

K Meera

Chris Eastwood
August 3rd, 1999, 04:34 AM
Hi

If you check in the MSDN help that came with VB6 under

Visual Basic Documentation \ Using Visual Basic\Programmer's Guide (all Editions) \ Visual Basic Specifications Limitations and File Formats \ Project limitations

(phew)

You'll find a description of what the control, code and data limitations are in a project.

50 Different forms for 50 different reports does sound a bit like overkill - isn't there any way that you can generalise these reports ? (having one form handling the run-time creation of the report based on certain parameters ?)



Chris Eastwood

CodeGuru - the website for developers
http://www.codeguru.com/vb

Meera K
August 3rd, 1999, 07:37 AM
Hi

Thanks for your reply.

I could go through the MSDN library and I found as such there is no limitation on the forms/controls.

But there is a statement indicating it is subject to the memory availability.

It would be nice if u could clarify regarding the statement indicating memory avaialability.

Yr commemt on reports , is valid . On looking into it, I found there are around 25 reports which are common to various disciplines[9] and 25 unique to each discipline. I may also try to reduce if possible.

In general, it will be better, if u could suggest as, what could be the maximum no of forms that can be comforatbly handled in a project.

Thanking you in advance and awaiting your earliest reply.

Regards


K Meera

Chris Eastwood
August 3rd, 1999, 07:47 AM
I Just found this in the MSDN in the same section :
----
A single project can contain up to 32,000 "identifiers" (any nonreserved keyword), which include, but are not limited to, forms, controls, modules, variables, constants, procedures, functions, and objects. Note that the actual number of identifiers is limited to available memory.

Variable names in Visual Basic can be no longer than 255 characters, and the names of forms, controls, modules, and classes cannot be longer than 40 characters. Visual Basic imposes no limit on the actual number of distinct objects in a project.
----

And this ...

----
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 generally accept no more than 25 levels of nested controls.
----

That's about as vague as I'd expect from Microsoft.

I think the largest number of forms I've had to handle in a project is around 40 - there did appear to be many more than that, but we built them on the fly according to rules in a database. This gave us much more flexibility and saved on memory usage also.

If you do need to have a lot of forms in your project, remember the golden rules :

1. A form that is loaded once and just hidden and shown when required throughout the life of the program is much quicker than a form that's loaded/unloaded when required.

2. A form that is loaded/unloaded when required uses less memory than that in method 1.

3. You should also remember that after unloading a form, set it's reference to Nothing, eg.


Unload frmX
set frmX = nothing




- to clear down any memory that the form is still using.



Chris Eastwood

CodeGuru - the website for developers
http://www.codeguru.com/vb