?
Solved

processing while a progress bar is loading

Posted on 1999-01-29
3
Medium Priority
?
220 Views
Last Modified: 2010-05-03
Let's say I have certain portion of codes which need to be run while I let the user see the progress bar on the form. How do I load the form containing the progress bar and at the same time it is processing something behind it?
0
Comment
Question by:ute
  • 3
3 Comments
 
LVL 10

Accepted Solution

by:
caraf_g earned 150 total points
ID: 1471149
Load the form first, then show it modeless

FormX.Show vbModeless

That displays the form on the screen with the progress bar.

Then, in your main routine, start doing the processing that will take some time, and update the progress bar on formX

FormX.ProgressBar. (etcetera)

Every time you update the value of the progress bar, follow it by
DoEvents
So that the user looking at the form will see the progress bar moving (without the DoEvents they won't see anything).

Good luck

0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1471150
PS - if the form containing the progress bar is your main form, you'll have to resort to using a Sub Main

Create a new BAS module in your VB project

In your BAS module, declare a sub as follows

Private Sub Main()

'Within this sub, you must load the main form as stated in the answer.
Form1.Show vbModeless

'Now you do your processing and update the progress bar on the main form

'Finally, hide form1
Form1.Hide

'...and show it modally to "actually" start the application
Form1.Show vbModal


End Sub


In your Project Properties you must set your Startup Object to Sub Main
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1471151
PS - if the form containing the progress bar is your main form, you'll have to resort to using a Sub Main

Create a new BAS module in your VB project

In your BAS module, declare a sub as follows

Private Sub Main()

'Within this sub, you must load the main form as stated in the answer.
Form1.Show vbModeless

'Now you do your processing and update the progress bar on the main form

'Finally, hide form1
Form1.Hide

'...and show it modally to "actually" start the application
Form1.Show vbModal


End Sub


In your Project Properties you must set your Startup Object to Sub Main
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
Suggested Courses

807 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