473,801 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

progressbar in a project

lee123
556 Contributor
i have been trying to add a progressbar to my project but don't know how and the last post i have posted one person answered it but never came back to help me with how?

so i am asking again because this is something alot of people probably would want to know how to do it
so i am placing a code down and hopefullly some one could post the steps on how this could and can be done. not just with my project but others too. so please have a heart and show us who don't know how, but want to learn to do it

here is the code i am wanting to have a progressbar in it to show things happening

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdCopy_Click()
  2.     Dim fso As New Scripting.FileSystemObject
  3.     Dim fld As Folder
  4.     cmdCopy.Caption = "Copying Folder!"
  5.     Set fld = fso.GetFolder(txtSourceOfFolder)
  6.     fld.Copy (txtDestinationOfFile)
  7.     Label1.Caption = "Copying Folder Is Completed!"
  8.     Beep
  9.     txtSourceOfFolder.Text = ""
  10.     txtDestinationOfFile.Text = ""
  11.     cmdExit.Enabled = True
  12. End Sub
as you can see from this code i have the button caption change when i click on it to say "Copying Folder!" and a label to say when it's done. this is great and all but a progressbar would look so much nicer and professional.


lee123
Sep 11 '08 #1
40 4810
tristanlbailey
31 New Member
The Visual Basic developer environment should offer a progress bar control for you to use. You can get it from the toolbox panel; the same place you got the command button from.
Sep 12 '08 #2
lee123
556 Contributor
what? that's not what I'm Talking about. i know where the progressbar is located read the question again...
Sep 12 '08 #3
lee123
556 Contributor
i want to know how to put it in my code to show something is going on, not that i don't know where it is.

lee123
Sep 12 '08 #4
tristanlbailey
31 New Member
Since your first post wasn't properly typed, I misunderstood.
It may not have been what you meant, but it's pretty much what you typed.

I haven't attempted this before, so I don't know if it will work. If it doesn't, you can use the overall structure to work out your own method.

Create the folder first, so that you have an FSO for it. Enumerate the initial folder's file collection for the total number of files, using the Files property of the FSO. Apply that value to the progress bar's Maximum property. Then, do the copy operation. In a loop, enumerate the files in the same way with the new folder, to work out the current number of files that exist within the new folder, and increment the progress bar's Value property until the maximum value has been reached. Finally, display the "completed" message.
Sep 12 '08 #5
lee123
556 Contributor
yea i guess your right after reading it again it kinda says that, well i guess I'm Sorry About that.tristanlbaily well i have a question lets say someone bring over some music you want to copy from a external hard drive the files may vary and then i wouldn't know what to set the max value to. thats why i made this program to copy my friends folder of music or songs

lee123
Sep 12 '08 #6
lee123
556 Contributor
o yea i forgot to tell you i don't know ho to do loops, well it's not that i haven't seen one i just never used them before. when i look at one i get confused on how to express it. sounds good when you say it in your head but when you typ it out it never works. that's why i placed the code in the first post so someone could help me place it in the code to understand how it's done. and i just noticed i misspelled your name sorry about that too.

lee123
Sep 12 '08 #7
lee123
556 Contributor
ok i have this, but this isn't working right some of the file are small but this is taking too long to finish.


Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdCopy_Click()
  2. PBTask.Max = 100
  3. PBTask.Min = 0
  4. Dim i
  5. Dim fso As New Scripting.FileSystemObject
  6. Dim fld As Folder
  7. For i = 1 To 100
  8.         cmdCopy.Caption = "Copying Files!"
  9.         Set fld = fso.GetFolder(txtSourceOfFolder)
  10.         fld.Copy (txtDestinationOfFile)
  11.         PBTask.Value = (100 * (i / 100))
  12.       Next i
  13.         cmdExit.Enabled = True
  14.         txtSourceOfFolder.Text = ""
  15.         txtDestinationOfFile.Text = ""
  16. End Sub
I did a search on progressbar and i found this code. added my stuff in it and this is what i have so why is it taking too long? I don't Understand how this is done.....I need help!!!!!!!

lee123
Sep 13 '08 #8
tristanlbailey
31 New Member
Dont' use the code you've found; it's BAD.
The copy method is repeated 99 times, so it will of course be slow.

I presume you are using Visual Basic .NET, 2005, or 2008?

I am currently constructing code for the aforementioned; if you are using something older (i.e. Visual Basic 6 or VBA), please reply promptly.
Sep 15 '08 #9
tristanlbailey
31 New Member
I've just found something that you may be interested in:

http://vbnet.mvps.org/index.html?code/callback/filebackupcallb ack.htm

I tried making a simpler version, but it was taking too long. The sample above should be your "cup of tea".
Sep 15 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3859
by: jomargon | last post by:
Hi! does anyone know how to insert progressbar within a listview? the purpose of the progressbar is to show a graphical representation of a percaentage. thanks! ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
2
6314
by: jez123456 | last post by:
Hi, thanks for the previous advice on progressbars with showing the percentage. I would now like to create a less clunky version. I.e at the moment my progressbar shows 7 separate steps. Some steps can take seconds to process, but others could take upto 10 minutes (leaving the users thinking nothing is happening!). Is there a way to show the progressbar smoothly increasing until the final step has finished instead of clunking it's way...
8
19634
by: needin4mation | last post by:
Please consider: foreach (ListViewItem item in listViewFiles.Items) { // Display the ProgressBar control. pBar1.Visible = true; // Set Minimum to 1 to represent the first file being copied. pBar1.Minimum = 1; // Set Maximum to the total number of files to copy. pBar1.Maximum = 4; //filenames.Length;
1
5428
by: Mehr H | last post by:
I've been trying to figure out how i can embed a Windows.Forms.ProgressBar in my webform (aspx) file. I have tried putting a Windows.Forms.ProgressBar as public on a regular winform designer form (form called ProgressForm) and the built the dll. Then I reference this new assembly from within my asp.net applicaiton and tried to access Windows.Forms.ProgressBar from within the ProgressForm but apparently it doesn't work. Because it won't...
4
4780
by: pmcguire | last post by:
Rather than putting a progress bar on all of my forms to show progress during time consuming tasks, I made a form called frmProgress with 2 controls, a Label and a ProgressBar. Suppose I expose 1 property -- prgValue (the Value of the ProgressBar); how do I use threading so that my time consuming task will open and display frmProgress as well as continually update prgValue (and display its progress), and then close frmProgress upon completion? ...
3
4796
by: Mitchell Vincent | last post by:
In other programming languages I've been able to easily change the style of a progress bar between smooth and blocked. I find that is either really hidden or impossible in .NET. Am I missing something? I'm shocked that .NET doesn't have a style property for the progressbar control! -- - Mitchell Vincent - kBilling - An easy and affordable billing solution
2
11129
by: =?Utf-8?B?QWFyb24=?= | last post by:
Since some controls such as the DataGridView take a long time to update themselves when performing certain tasks, I have added a StatusStrip with a ProgressBar on it. While I am updating the controls on the form, I want the ProgressBar to scroll in marquee mode. However, I cannot seem to get this to work. I set the StatusStripLabel to the text I want such as "Updating data..." and then set the ProgressBar's Style property to Marquee...
4
2513
by: sivamoorthy | last post by:
how to use a progressbar in a one cpp file but defined in another header file. the function in which i am using is a static member function. how to use the progressbar inside the function code: file name : flash.cpp void CFlasher::OnStartDownload (void *pDublicate) { bValueRet = DeviceIoControl (hHandle, \ (DWORD) IOCTL_SCUSBDFU_DETACH, NULL, \
7
1584
lee123
by: lee123 | last post by:
Can some one tell me how i can add a progressbar to my project. Because right know i am using a animation picture. the progressbar i want to add has labels that tells how long it will take to finish and elapsed time. lee123
0
9698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10516
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10292
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10052
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9101
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6829
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4156
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2959
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.