How to: Provide a Progress Dialog Box for File Operations (C# Programming Guide) Home
This page is specific to:.NET Framework Version:3.54.0
C# Programming Guide
How to: Provide a Progress Dialog Box for File Operations (C# Programming Guide)

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.

NoteNote:

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

  • In Visual Studio, open or create a project and then click Add Reference on the Project menu. On the .NET tab, select Microsoft.VisualBasic in the Component Name column.

To add a using directive

Example

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);
    }
}


See Also

Other Resources

Change History

Date

History

Reason

July 2008

Added topic.

Content bug fix.

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View