• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 476
  • Last Modified:

How do I do a FileOpen in a C# WinForms app?

I need to open a file and want to use the default dialog for that. How do I make that work? I also have a file type I am expecting, but would like them to open "*.*"

Please let me know.

Thanks,
newbieweb
0
newbieweb
Asked:
newbieweb
3 Solutions
 
xoperatorCommented:
Hi,

Here is a perfect article that describes how to implement your request.

http://www.java2s.com/Code/CSharp/GUI-Windows-Form/OpenFileDialogwithfiletypes.htm

Enjoy !
0
 
VenkatgviCommented:
hi,

use the below code.


using System.IO;

DirectoryInfo dInfo = new DirectoryInfo(<PATH>);
FileInfo[] fInfo = dInfo.GetFiles(<EXTENSION>, SearchOption.AllDirectories);

Note: u can give the extension as *
0
 
xoperatorCommented:
If you need anything else, please ask, it could be a little bit complicated if you are new in this area.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
.net comes with something fully build, here the full tutorial:
http://www.functionx.com/vcsharp2003/controls/openfiledialog.htm
0
 
newbiewebSr. Software EngineerAuthor Commented:
thanks.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now