|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Copy files and progressbarI want to copy a file from a server to a local machine.
The process should be shown displayed by a progressbar. Has anybody an example of this? reidarT You may not get much of a response as both working a progress bar
control and copying a file, at least with the File.Copy method are both so absurdly simple, no one will bother to help. And if you do use the FileCopy method to copy the file there ain't no way in hell you can hook a progress bar to it (if there is some way, I'd love to hear it!!). To hook a file copy operation to a progress bar you are going to have to read a chunk of the file with some File Reader mechanism (there are a couple, look up FileReader class and FileStream class), update the progress bar, and write the chunk out to the new file. If the file is binary, you will need to hook a BinaryReader to your input stream and a BinaryWriter to your output stream. All this is covered pretty well by the help text. za***@construction-imaging.com schreef:
Show quoteHide quote > You may not get much of a response as both working a progress bar A time ago I found this URL, it's probably just what you need:> control and copying a file, at least with the File.Copy method are > both so absurdly simple, no one will bother to help. And if you do use > the FileCopy method to copy the file there ain't no way in hell you can > hook a progress bar to it (if there is some way, I'd love to hear > it!!). > > To hook a file copy operation to a progress bar you are going to have > to read a chunk of the file with some File Reader mechanism (there are > a couple, look up FileReader class and FileStream class), update the > progress bar, and write the chunk out to the new file. If the file is > binary, you will need to hook a BinaryReader to your input stream and a > BinaryWriter to your output stream. All this is covered pretty well by > the help text. http://khsw.blogspot.com/2005/08/copy-file-with-progressbar-in-vbnet.html That was some interesting code. I do not like calling APIs directly
from .NET code, but I suppose sometimes it's necessary. And writing a class wrapper around them and make them look .NETish would be acceptable.
"VB (9) Rocks" slide show
VB.Net 2005 Treeview example required WebBrowser Getting icon from form in dynamically loaded DLL Optimizing Repeated PictureBox.Paints padding text field with blank in MS Access vs OLEDB Jet 4.0 Parsing XML strings control collection Threading make computer slow Block Step Into Debugging for a function |
|||||||||||||||||||||||