Hiding forms whilst repainting

Posted on 2005-04-11
Last Modified: 2012-05-05
I have an application which uses three forms, but implements a tab control to give the illusion of being a single-form application.  There is a problem when I switch from one form to another using code like this:

'''We are in the form frmFirst

The controls from frmSecond slowly appear over frmFirst and it looks ugly.  I have two related questions:

1 How do I switch off screen updates whilst the controls are being drawn

2 The first time the a form is activated it takes several seconds longer.  I want to show a title form first when the application starts, and at the same time load the forms into memory but without them showing.  Is there a way to do this?

My hunch is that this is easy, but darned if I can find it in the VB help pages.

Question by:jfell
    LVL 32

    Accepted Solution

    1) Check the LockWindowUpdate API function to prevent your window from redrawing.

    2)  Use:
    Load Form1
    to load a form into memory - but not show it.
    Use Form1.Show when you are ready to show the form.

    Author Comment

    2) Works! :-)

    1) It looks promising, but I need to start something else right now, so I've accepted the answer in faith.




    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    VBA Modification 5 35
    VBA: Do Loop with Input Box 14 38
    change vba from autofit to 13.5 width? 4 25
    VBA error replacing data 6 29
    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    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…

    761 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

    10 Experts available now in Live!

    Get 1:1 Help Now