[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Disabling the main form during startup of a VB 6 app

Posted on 2007-03-23
8
Medium Priority
?
252 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

649 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