Solved

Display window telling user to wait while program initilizes

Posted on 2003-10-23
8
237 Views
Last Modified: 2012-05-04
When my program is loaded for the first time, like any other it has a few tasks to complete before the user can begin using it (i.e. loading some configuration files and creating some OLE objects).

During this time, I would like to display a windows with no buttons, telling the user to wait while the configuration is initilized.  When the tasks have finished, I want the window to disappear, and have the program load the main form.

What is the best way to do this?

I created a form called LoadingObjectsMess that has one label field giving the user a message to wait.  Before start the configuration process back in Main, I used the command:
     Set Mess = New LoadingObjectsMess
     Mess.Display
My display method simply makes the form visible, then sets the value of the only label on the form to equal the "Please wait" message.  When the configuration tasks complete I use the command:
     Mess.Clear
The Clear method simply unloads the form using the Unload.Me statement.

For some reason when the program loads, only the outline of the message box form is drawn with a transparent inside, and it never displays the "Please wait" message until the initilization task are complete.

This does me no good.

Am I going about this the correct way, or is there another way to accomplish this more logically?

Thanks!
0
Comment
Question by:lilpaul504
8 Comments
 

Accepted Solution

by:
JMCrenshaw earned 50 total points
ID: 9609090
after you set the value of the label try using the refreash method on the form

me.refreash

for good measure you could add "doevents" also

both of these should get the screen to update for you.

0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9609093
Remember to Refresh the window or the control when you update it.

You can do this using  Mess.Refresh and lblMess.Refresh (if lblMess is the name of the label control)
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9609145
This seems to work for me.  Create a project and add a second form.  Add a label to the second form.

Paste this code on the first form:

Private Sub Form_Load()
    Dim a As Single
    Dim b As Date
   
    Load Form2
    Form2.Label1.Caption = "Loading..."
    Form2.Show
    Form2.Refresh
   
    For a = 1 To 100000
        b = Now()
    Next a
   
    Unload Form2
End Sub

Without the Form2.Refresh command I get the exact same symptoms as you did.

Hope this helps.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:GenericUserName
ID: 9609163
As long as the label is set to visible on that form, then you should be able to do this:
---
Private Mess As LoadingObjectsMess 'Put these in the beginning somewhere to give it time to load up
Set Mess = New LoadingObjectsMess

'When ready to show it, you may try not creating a function to do it from within, but controlling it from outside:
Mess.Show

'When ready to close it,
Mess.Hide
Set Mess = Nothing
---
When creating your form, have the label already in there, and set to visible. This methodology should work...
0
 
LVL 1

Expert Comment

by:fsaims
ID: 9610134
Add second form Form2 in your project, set its BorderStyle Property to 0-Fixed Single, add label1 control
Use this code before your processing code

Load Form2
Form2.Label1.Caption="Loading........."
Form2.Show vbModeless, Me
Form2.Refresh

(Place your processing code here)


Unload Form2

0
 
LVL 8

Expert Comment

by:bramsquad
ID: 9610191
dim frm as new form1

frm.ShowDialog()

//do your stuff

frm.close()

thats really all you need.  just set the values of borders and stuff to false, and you have a load up form good enough for production

Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.MaximizeBox = False
Me.MinimizeBox = False

bramsquad


0
 
LVL 27

Expert Comment

by:planocz
ID: 10173693
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
No response from lilpaul504 from 10/23/2003 comment
Award points to JMCrenshaw is recommend.
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

planocz
EE Cleanup Volunteer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

867 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