Number of Forms in a Visual Basic Solution

Posted on 2011-04-21
Last Modified: 2012-05-11
Is there a practical limit to the number of forms that should be built into a Visual Basic project?  In the past I've tried to put too much onto a single form (e.g., Vendor Maintenance, Accounts Payable Input, Accounts Receivable Input) and the editing begins to "bog down".  So I break out each of the three examples above to it's own form.  But I could end up with hundreds of forms by the time I finish this project.  Is that any kind of run-time processing problem or any other kind of problem?  Thanks.
Question by:StoneCutter3
    LVL 83

    Expert Comment

    I think all depends on the resources of system available to VS. I am not aware of any limit.

    But what is the size of exe going to be if you have hundreds of forms?
    LVL 8

    Accepted Solution

    The MSDN documentation has something like this:

    (1) usually, a single project can hold 32k 'identifiers'. That can include  forms, controls, modules, variables, constants, procedures, functions, objects etc. It is obvious that the actual stuffs are only limited to available memory.
    (2) VB doesn't have any known restrictions on the actual number of objects that it can ave. However, the variables can't be longer than 255 chars.
    (3) The total number of controls allowed in a form usually depend on the category/type of the controls. Available system resource has also a major role in this context.
    (4) MSDN says, a form can have maximum of 254 controls!

    To speed up things, i think you can follow the unloading technique.

    Unload frm1
    set frm1 = nothing

    This can very well clear out the memory that the form may be holding.

    Hope this helps you in one or other way.
    LVL 85

    Assisted Solution

    by:Mike Tomlinson
    @jimsweb...Based on #4 and your code snippet, you must be referring to VB6.  I know VB.Net doesn't have that limitation...  =)
    LVL 8

    Expert Comment

    Yes you are right. :) i have read it somewhere. So thought of putting it here.

    Author Closing Comment

    Thanks guys.  Good input.
    LVL 83

    Expert Comment

    So a comment describing VB6 limits answered your question?

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    754 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

    21 Experts available now in Live!

    Get 1:1 Help Now