Solved

Status bar

Posted on 2001-09-15
4
233 Views
Last Modified: 2010-05-02
Hi,

How to write a pie of code that show the status bar (blue color) in VB like when we downloading the file from internet?

My scenario is every time when user click on the Export Button, the program will extract the data from database (about 4000 records) and then write to excel.

I would like to add the status bar to show the user how many percentage being process....and after finished processing, then pop the message box to tell the user that process is completed. My point is to show the user that the program is processing the data and is not hang!


Can anyone show me some working code?

Thanks.

0
Comment
Question by:ht055
  • 2
4 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 50 total points
ID: 6484516
Hi hto55, you could use the progress bar control as supplied by Microsoft is in Microsoft Windows Common controls 6 in the project>components section of VB- depending on what version you have I think.

another option is using this code from MVP Jonathon West to simulate a progress bar in Word

The procedures are as follows, and assume that the progress bar has a Width of 200, and that the lower control is called ProgressBar and the upper one is ProgressBarText.

Private lngPercent As Long

Property Let PercentComplete(Percent As Long)
If Percent < 0 Then
    lngPercent = 0
ElseIf Percent > 100 Then
    lngPercent = 100
Else
    lngPercent = Percent
End If
ProgressBarText.Caption = CStr(lngPercent) & "%"
ProgressBar.Width = 2 * lngPercent
End Property

Property Get PercentComplete() As Long
PercentComplete = lgnPercent
End Property

HTH:O)Bruintje
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6485420
Hearing...
0
 

Author Comment

by:ht055
ID: 6489173
Hi,

Do i have to put the record count? So the status bar will display 100% once is enf of last record?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6496677
bruintje, i just understood your thinking!
Cheers
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

743 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

9 Experts available now in Live!

Get 1:1 Help Now