VS 2008 C# Example using FileDlg

Posted on 2011-10-14
Medium Priority
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
  • 2
  • 2
LVL 75

Accepted Solution

käµfm³d   👽 earned 2000 total points
ID: 36972025
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

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

Expert Comment

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

Author Closing Comment

ID: 36983662
Excellent response.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

850 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