VS 2008 C# Example using FileDlg

Posted on 2011-10-14
Last Modified: 2012-05-12
Can anyone point me to some sample VS2008 C# code that will allow me to present a file dialog window so the user can select an input file and also allow the user to specify an output file that will be written to as data processing occurs on the input file?
Question by:rwheeler23
    LVL 74

    Accepted Solution

    You could do something like this:

    string inputFile;
    string outputFile;
    if (this.openFileDialog1.ShowDialog() == DialogResult.OK &&
        this.saveFileDialog1.ShowDialog() == DialogResult.OK)
        inputFile = this.openFileDialog1.FileName;
        outputFile = this.saveFileDialog1.FileName;

    Open in new window


    Author Comment

    I will give this a shot in the morning? Will this prompt the user for the input filename and then the output filename?
    LVL 74

    Expert Comment

    by:käµfm³d 👽
    Yes, provided they don't cancel out of the first dialog.

    Author Closing Comment

    Excellent response.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now