Questions tagged [openfiledialog]

The OpenFileDialog is a (component) class in the .NET Framework that prompts the user to open one or multiple files.

The OpenFileDialog component allows users to browse the folders of their computer or any computer on the network and select one or more files to open. The dialog returns full path names of the files selected by user.

1003 questions
356
votes
9 answers

How to use OpenFileDialog to select a folder?

How to use OpenFileDialog to select folders? I was going to use the following project: https://github.com/scottwis/OpenFileOrFolderDialog However, I faced one problem. It uses the GetOpenFileName function and OPENFILENAME structure. And OPENFILENAME…
Yun
  • 4,353
  • 4
  • 18
  • 36
255
votes
17 answers

How do you configure an OpenFileDialog to select folders?

In VS .NET, when you are selecting a folder for a project, a dialog that looks like an OpenFileDialog or SaveFileDialog is displayed, but is set up to accept only folders. Ever since I've seen this I've wanted to know how it's done. I am aware of…
OwenP
  • 23,410
  • 13
  • 62
  • 95
242
votes
12 answers

Setting the filter to an OpenFileDialog to allow the typical image formats?

I have this code, how can I allow it to accept all typical image formats? PNG, JPEG, JPG, GIF? Here's what I have so far: public void EncryptFile() { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "txt files…
Sergio Tapia
  • 36,466
  • 70
  • 175
  • 253
196
votes
2 answers

Open file dialog and select a file using WPF controls and C#

I have a TextBox named textbox1 and a Button named button1. When I click on button1 I want to browse my files to search only for image files (type jpg, png, bmp...). And when I select an image file and click Ok in the file dialog I want the file…
NoobMaster69
  • 2,201
  • 3
  • 16
  • 24
130
votes
3 answers

Multiple file extensions in OpenFileDialog

How can I use multiple file extensions within one group using OpenFileDialog? I have Filter = "BMP|*.bmp|GIF|*.gif|JPG|*.jpg|PNG|*.png|TIFF|*.tiff" and I want to create groups so JPG are *.jpg and *.jpeg, TIFF are *.tif and *.tiff and also 'All…
Ichibann
  • 4,141
  • 8
  • 30
  • 38
117
votes
6 answers

Quick and easy file dialog in Python?

I have a simple script which parses a file and loads it's contents to a database. I don't need a UI, but right now I'm prompting the user for the file to parse using raw_input which is most unfriendly, especially because the user can't copy/paste…
Buttons840
  • 8,107
  • 14
  • 50
  • 81
100
votes
5 answers

WPF OpenFileDialog with the MVVM pattern?

I just started learning the MVVM pattern for WPF. I hit a wall: what do you do when you need to show an OpenFileDialog? Here's an example UI I'm trying to use it on: When the browse button is clicked, an OpenFileDialog should be shown. When the…
Judah Gabriel Himango
  • 55,559
  • 37
  • 152
  • 206
69
votes
2 answers

Open File Dialog, One Filter for Multiple Excel Extensions?

I want to use an OpenFileDialog object to browse to an excel file. I would like to set the filter to open files with different types of excel extensions like: .xls, .xlsm, .xlsx and so on. what I am using is this: OpenFileDialog of = new…
netcat
  • 1,105
  • 1
  • 8
  • 17
66
votes
2 answers

can the Open File dialog be used to select a Folder?

The "Browse For Folder" Windows dialog is very inconvenient because: it has no Path box where I can paste the path I want (eg from Total Commander) it always starts from the Desktop with everything closed Is there a way to use the "Open File"…
Vladimir Alexiev
  • 2,176
  • 1
  • 16
  • 28
50
votes
2 answers

Obtaining only the filename when using OpenFileDialog property "FileName"

I am trying to include only the filename of the file I've selected in the OpenFileDialog in the label1.Text property, but I haven't found a solution yet. I know I could use a method from the string class on the ofd instance to filter out the whole…
Birdman
  • 4,714
  • 11
  • 42
  • 63
49
votes
7 answers

Open File Dialog MVVM

Ok I really would like to know how expert MVVM developers handle an openfile dialog in WPF. I don't really want to do this in my ViewModel(where 'Browse' is referenced via a DelegateCommand) void Browse(object param) { //Add code here …
Jose
  • 10,273
  • 18
  • 63
  • 88
44
votes
10 answers

Netbeans Shortcut to Open File

I remember seeing someone use a shortcut in NetBeans to open a dialog similar to phpStrom that can open files based on class names or is it file name. whats that?
Jiew Meng
  • 74,635
  • 166
  • 442
  • 756
35
votes
2 answers

Opening multiple files (OpenFileDialog, C#)

I'm trying to open multiple files at once with the OpenFileDialog, using FileNames instead of FileName. But I cannot see any examples anywhere on how to accomplish this, not even on MSDN. As far as I can tell - there's no documentation on it either.…
jay_t55
  • 10,203
  • 26
  • 92
  • 167
31
votes
10 answers

Select either a file or folder from the same dialog in .NET

Is there an "easy" way to select either a file OR a folder from the same dialog? In many apps I create I allow for both files or folders as input. Until now i always end up creating a switch to toggle between file or folder selection dialogs or…
barry
  • 971
  • 3
  • 12
  • 26
29
votes
6 answers

How to get file extension from OpenFileDialog?

I want just get Image(.JPG,.PNG,.Gif) File from my OpenFileDialog How can I get file extension from OpenFileDialog? Is it impossible?
M.Azad
  • 3,485
  • 7
  • 43
  • 72
1
2 3
66 67