?
Solved

processing while a progress bar is loading

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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 In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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
Course of the Month15 days, 9 hours left to enroll

741 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