?
Solved

Disabling the main form during startup of a VB 6 app

Posted on 2007-03-23
8
Medium Priority
?
245 Views
Last Modified: 2012-05-05
My VB6 app runs a splash screen that calls the main form. The main form involves a lot of processing before it's ready for user interaction.

I'm trying to set the main form to enabled = false for about 8 seconds to cover the processing period. This is easily done once the form is fully visible and its processing is done. But that doesn't meet the need to prevent premature user interaction during the initial processing, and I can't find a workaround either for the splash screen or during the main form loading period.

Suggestions for solutions gratefully received.

0
Comment
Question by:Gordon_Atherley
[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
8 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 18783906
How are you opening your 'Main Form' - please show the code that creates and opens the form object.

AW
0
 

Author Comment

by:Gordon_Atherley
ID: 18783926
In the splash form

Private Sub Timer1_Timer()
    frmDataFromClass.Show 'This is the main form
    Unload Me
 End Sub
0
 
LVL 53

Assisted Solution

by:Ryan Chong
Ryan Chong earned 498 total points
ID: 18784307
You can also put your processing scripts in your splash screen form if necessary, so that you no need to load your processing scripts again on your main form. Make sense?
0
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!

 
LVL 12

Assisted Solution

by:jkaios
jkaios earned 498 total points
ID: 18784328
Instead of using a Timer on the splash form, you can do this approach.

1. Add a standard module (if not already added)
2. Create a procedure call "Sub Main"
3. Set the Startup Object via the Project->Properties dialog to 'Sub Main'
4. In the Sub Main procedure, use the following code:

Private Sub Main()

   '// Show the splash screen
   frmSplash.Show
   frmSplash.Label1.Caption = "Loading main program, please wait ..."
   DoEvents

   '// Load the main form to execute the processing, but do not display it yet
   Load frmMain
   
   '// At this moment, the codes in the Form_Load event of the main form finished running
   '   so, we unload the Splash screen.
   Unload frmSplash

   '// Now display the main application form
   frmMain.Show

End Sub
0
 
LVL 12

Expert Comment

by:jkaios
ID: 18784333
>> 2. Create a procedure called "Sub Main" IN THE STANDARD MODULE (added in step 1)
0
 

Author Comment

by:Gordon_Atherley
ID: 18784887
Thanks for these leads. I'll test them out and report back.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 504 total points
ID: 18784930
to "disable" a form when loading, use the form_load event of the form itself:

Private Sub Form_Load()
  'show and disable the form
  me.Enabled = false
  me.Visible = true
  Doevents

  ' here, do the other processing
  ...

End Sub
0
 

Author Comment

by:Gordon_Atherley
ID: 18785721
Thanks to you all., I arrived at a workaround.

I found that the solutions you offered caused problems with form resizing and other background processes such as loading listviews. Then the solutionhit me: ensure that the loading of lthe lists and menubar leaves them disabled.

The lists and menubar are enabled after a wait of a few seconds following the execution of the processes. Not glamourous but effective.

You all led me to try things out, which brought me to my solution,  so I'll divide the points. Many thanks.

Gordon

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month10 days, 8 hours left to enroll

764 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