Updated: July 2008
The easiest way to provide a standard Windows progress dialog box when you perform file operations is to use the FileSystem object that is provided in the Microsoft.VisualBasic namespace.
Note: |
|---|
|
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.
|
To add a reference to Microsoft.VisualBasic.dll
To add a using directive
The following code copies the directory specified by sourcePath into the directory specified by destinationPath. It also provides a standard Windows progress dialog box that shows the estimated time remaining before the operation finishes.
// Requires project reference to Microsoft.VisualBasic
using Microsoft.VisualBasic.FileIO;
class FileProgress
{
static void Main()
{
string sourcePath = @"C:\Users\public\documents\";
string destinationPath = @"C:\testFolder";
FileSystem.CopyDirectory(sourcePath, destinationPath,
UIOption.AllDialogs);
}
}
Other Resources
Date | History | Reason |
|---|
July 2008
| Added topic. |
Content bug fix.
|