Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

processing while a progress bar is loading

Posted on 1999-01-29
3
Medium Priority
?
211 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
[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
  • 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

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!

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…
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…
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…
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

636 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