file copy progress bar
-
Ive been trying to find an example on how to make a progress bar progress with the copying of a file using the copyTo command. does anyone know how to make it work?
-
Ive been trying to find an example on how to make a progress bar progress with the copying of a file using the copyTo command. does anyone know how to make it work?
You won't be able to do a real progress bar with File.Copy because it is synchronous and does not give any feedback as to the overall progress of the operation. You could easily do this yourself, however. Open the file you want to copy, and create a destination file you want to copy the file to. Read in the source file byte-by-byte, and write those bytes to the destination file. Every few bytes, raise an event indicating the overall progress of the operation. Interested components would simply listen to that event and could update the value of a progress bar if they wanted.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: And in this corner, the Party of Allah The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
-
You won't be able to do a real progress bar with File.Copy because it is synchronous and does not give any feedback as to the overall progress of the operation. You could easily do this yourself, however. Open the file you want to copy, and create a destination file you want to copy the file to. Read in the source file byte-by-byte, and write those bytes to the destination file. Every few bytes, raise an event indicating the overall progress of the operation. Interested components would simply listen to that event and could update the value of a progress bar if they wanted.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: And in this corner, the Party of Allah The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
How would I go about doing this? Im still pretty new to C# and havent learned alot of things yet
-
How would I go about doing this? Im still pretty new to C# and havent learned alot of things yet
Go about reading and writing to files, bytes at a time? Have a look at the basic file I/O document[^] on MSDN.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: And in this corner, the Party of Allah The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
-
You won't be able to do a real progress bar with File.Copy because it is synchronous and does not give any feedback as to the overall progress of the operation. You could easily do this yourself, however. Open the file you want to copy, and create a destination file you want to copy the file to. Read in the source file byte-by-byte, and write those bytes to the destination file. Every few bytes, raise an event indicating the overall progress of the operation. Interested components would simply listen to that event and could update the value of a progress bar if they wanted.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: And in this corner, the Party of Allah The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
Up
I am a chinese I love my country.
-
Ive been trying to find an example on how to make a progress bar progress with the copying of a file using the copyTo command. does anyone know how to make it work?
there is a much simpler option. Simply add the reference, Microsoft.VisualBasic dll to your c# references project. Within the Microsoft.VisualBasic dll is the VB.NET file copy routine which displays a copy progress dialog much like the windows one. Here is an example. Microsoft.VisualBasic.FileIO.FileSystem.CopyFile("c:\helloworld.txt","c:\temp\helloworld.txt",UIOption.AllDialogs,UICancelOption.DoNothing);
-
there is a much simpler option. Simply add the reference, Microsoft.VisualBasic dll to your c# references project. Within the Microsoft.VisualBasic dll is the VB.NET file copy routine which displays a copy progress dialog much like the windows one. Here is an example. Microsoft.VisualBasic.FileIO.FileSystem.CopyFile("c:\helloworld.txt","c:\temp\helloworld.txt",UIOption.AllDialogs,UICancelOption.DoNothing);
Hi, i tried ur way but cought in probs. i gives me with error "the type or namespace name 'FileIO' does not exists in the class or namespace 'microsoft.visualbasic' (are you missing ans assembly reference?)" i have also included the reference in the project of microsoft.visualbasic dont know wats the prob. can u help? Nitin...
-
Hi, i tried ur way but cought in probs. i gives me with error "the type or namespace name 'FileIO' does not exists in the class or namespace 'microsoft.visualbasic' (are you missing ans assembly reference?)" i have also included the reference in the project of microsoft.visualbasic dont know wats the prob. can u help? Nitin...
-
Are you using visual studio 2005? As it works for me under that IDE. Apart from that I cant work out what could be your problem.
-
Hi, thanx for reply. no i m not using vs2005. i am using vs2003. can u help. thanx Nitin...
-
there is a much simpler option. Simply add the reference, Microsoft.VisualBasic dll to your c# references project. Within the Microsoft.VisualBasic dll is the VB.NET file copy routine which displays a copy progress dialog much like the windows one. Here is an example. Microsoft.VisualBasic.FileIO.FileSystem.CopyFile("c:\helloworld.txt","c:\temp\helloworld.txt",UIOption.AllDialogs,UICancelOption.DoNothing);
This sounds like a good option, except the progress bar I am using is in the status strip instead of a dialog box