Asyncronous File Copy

jdy0803

Well-known member
Joined
Sep 9, 2012
Messages
73
Location
Santa Clarita
Programming Experience
10+
I'm doing File Copy using System.IO.File.Copy.
In case of huge size of file, for example 5GB, and network directory, it takes too long time to complete and block to do other job of program.
I want to do file copy asyncronously.
How to implement this?
 
BackgroundWorker is probably the best bet here, but if you want to learn about multi-threading you should also look into System.Threading Namespaces ()
 
Hi,

The way to achieve this is to move the actual file copy routine into a BackgroundWorker. That way, the UI thread will stay responsive to the other processes that need to be completed by your project. See here:-

BackgroundWorker Class (System.ComponentModel)

Hope that helps.

Cheers,

Ian

Thanks,

I'll try backgroundworker.
But have one more question.
I want to display pregress status in separate modeless small window which has backgroundWorker control.
This window will be displayed until file copy completes.
And should be displayed foreground even though I exit current form and go to another form.
Is it possible?
If possible, how to make modeless/foreground form?
 
Last edited:
Back
Top