Solved

processing while a progress bar is loading

Posted on 1999-01-29
3
181 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 50 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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

726 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