Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Word, PowerPoint, Outlook, and Other Office Products > Progress Bar


Reply
 
Thread Tools Display Modes
  #1  
Old 07-11-2001, 02:41 AM
Adi
Guest
 
Posts: n/a
Default Progress Bar


Hi all,

I am using the FileCopy function on an Access 97 form to copy various files to variuos locations.

some of these files are very big and i need to show the users that they are not sitting there thinking that the program is not doing anything.

i have already put in the Hourglass so that they know something is happening but what i realy want to do is to have a progress bar going along showing when a file has finished copying.

i know there is an ActiveX component for a progress bar but i dont know how to use it or tell it what to look for.

Please Help.

Adi

Reply With Quote
  #2  
Old 07-11-2001, 05:27 AM
pratim_g
Guest
 
Posts: n/a
Default Re: Progress Bar

Hi,
Include the component by checking the
Microsoft windows common control(6)
from the project-> components menu.
It is a small bar in your tool box with blue shades.

The min property sets the progress bars initial value
The max property sets the Maximum value to it can go and
The Value property will set the current postition of the bar.

Further help can be got from the MSDN library.
I hope this helps...
Pratim

Reply With Quote
  #3  
Old 07-11-2001, 06:32 AM
Adi
Guest
 
Posts: n/a
Default Re: Progress Bar

thanx for that, but unfortunately, reading anything out of the MSDE library is like reading quantum physics.

i understand how to put the bar in and how to set the minimum value and max value but when copying a file, there is no break! how do i tell it to go from one side to the other while it is copying the file?

i enclose the code i am using:

ActiveXCtl140.Value = 10
FileCopy "H:\MyFile.mdb", "C:\MyFile.mdb"
ActiveXCtl140.Value = 12000

my file size is 12mb. what comes in the middle???

all it does now is one box at the beginning and the whole bar filled after the file is copied. i need it to show like you see when you copy a file in windows when the bar goes rather slowly from one side to the other.

whatever help you can give me would be great.

thank you very much

Adi

Reply With Quote
  #4  
Old 07-11-2001, 07:06 AM
Bigpapou
Guest
 
Posts: n/a
Default Re: Progress Bar

Hi,

Maybe this will help

Dim progression As Variant
Dim lng as double
Dim compteur as integer
"compteur is a Recordcount on a table or recordset"

progression = SysCmd(acSysCmdInitMeter, "Transfert en cours", compteur)
For lng = 1 To compteur
progression = SysCmd(acSysCmdUpdateMeter, lng)
"do something here"
Next lng
progression = SysCmd(acSysCmdClearStatus)

This will add a little blue progression bar in the lower part of your screen. If you need more help, search for SysCmd in the help.

Bigpapou

Reply With Quote
  #5  
Old 07-11-2001, 07:23 AM
Adi
Guest
 
Posts: n/a
Default Re: Progress Bar

well, it does and it doesn't.

it will work if i use it to copy multiple files (so if i have 3 files i can do 1 to 3 and after each file is complete it will add another 3-4 blue boxes to the bar.) but it will not work for 1 file and when it is finished.

so both methods have more of less the same problem.
which is how to tell the bar when the file is being copied and how far has it got to go.

thanx for the help

Adi.



Reply With Quote
  #6  
Old 07-11-2001, 07:37 AM
Bigpapou
Guest
 
Posts: n/a
Default Re: Progress Bar

Well I just got an idea that may solve your problem...
Try to use the ActiveX "ProgressBar" control and upgrade the Value every second (sorry but I don't know how to count the second). Something like this.

Dim counter as Integer
"code"
flag:
"when a second as past"
counter = counter + 1
progressBar.Value = counter
if "transfert is over"
exit function
else goto flag

As you noticed, I didn't try it so you'll have to work on that... if you use it. But hey, maybe you'll have a great idea reading this.

Bigpapou

Reply With Quote
  #7  
Old 07-11-2001, 08:09 AM
Adi
Guest
 
Posts: n/a
Default Re: Progress Bar

hmm....

sounds like a good idea. but, as VBA and code goes, the code will not process the next line (in this case "Flag:") until the code line has finished processing.

so by the time the code starts actioning the counter, the file has already finished copying.

i think the trick would be to somehow start a counter while the file gets copied.

thanx for the tip though

Adi.

Reply With Quote
  #8  
Old 07-12-2001, 03:11 AM
Adi
Guest
 
Posts: n/a
Exclamation Re: Progress Bar

Can someone Please help me with this. i'm desparate!

Reply With Quote
  #9  
Old 07-13-2001, 04:36 PM
zocker
Guest
 
Posts: n/a
Default Re: Progress Bar

I have wrestled with this on and off, and did not find a solution BUT you could perhaps use the Hourglass function to change the nouse pointer to an hourglass whilst the Comp is thinking.

Regards

Reply With Quote
  #10  
Old 07-16-2001, 04:33 AM
waqas's Avatar
waqas waqas is offline
Junior Contributor
 
Join Date: Jun 2001
Location: Kuala Lampur
Posts: 266
Default Re: Progress Bar

hey hi,
i would say the idea given by bingpapou can be considered......well the way u put hourglass......if u keep a counter in your loops and increase it as the loops r ending and starting............and assign the value oo the progressbar.value, well i m not sure about it but its just an isea, i might be trying this in couple of days coz i have to use it in one of my coees......

waqas

Reply With Quote
  #11  
Old 07-19-2001, 09:06 AM
Adi
Guest
 
Posts: n/a
Default Re: Progress Bar

well, i think i know how to do this but, i don't know exactly how.

on VB (not VBA) there is a control called Timer. on each interval of the timer's passing, i can insert a code to tell the progress bar to put another box like this:

private sub timer1_timer()
progressbar1.value=progressbar1.value+1
end sub

'and on the program:

private sub Copying_click()
timer1.enabled
copyfile "C:\myfile.mdb","C:\My documents\myfile.mdb" '(big file)
end sub

i'm pretty sure this could work BUT, the timer control only exists in Visual Basic. not VBA.

does anyone have any input on this?

thx

Adi





Reply With Quote
  #12  
Old 07-19-2001, 02:03 PM
zocker
Guest
 
Posts: n/a
Default Re: Progress Bar

You can set the TimerInterval either in code or in the properties of the Form which the code is in... If TimerInterval is set at 1000 then Timer event fires every second. Better to set it in code as it will not run when not required.
Regards

Reply With Quote
  #13  
Old 07-20-2001, 03:04 AM
Adi
Guest
 
Posts: n/a
Default Re: Progress Bar

thank you. i did try it but it didn't work so, once again, i'm back to square 1.

thx for the help

Adi

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->