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.

1068 questions
33
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
  • 1,021
  • 3
  • 13
  • 27
30
votes
3 answers

Reading a text file using OpenFileDialog in windows forms

I am new to the OpenFileDialog function, but have the basics figured out. What I need to do is open a text file, read the data from the file (text only) and correctly place the data into separate text boxes in my application. Here's what I have in…
xavi
  • 423
  • 4
  • 8
  • 13
28
votes
8 answers

Setting the start position for OpenFileDialog/SaveFileDialog

For any custom dialog (form) in a WinForm application I can set its size and position before I display it with: form.StartPosition = FormStartPosition.Manual; form.DesktopBounds = MyWindowPosition; This is particularly important when dealing with…
Michael Sorens
  • 35,361
  • 26
  • 116
  • 172
23
votes
5 answers

Good way to check if file extension is of an image or not

I have this file types Filters: public const string Png = "PNG Portable Network Graphics (*.png)|" + "*.png"; public const string Jpg = "JPEG File Interchange Format (*.jpg *.jpeg *jfif)|" + "*.jpg;*.jpeg;*.jfif"; public const string Bmp…
Pedro77
  • 5,176
  • 7
  • 61
  • 91
22
votes
3 answers

Bringing JFileChooser on top of all windows

I seem to have a problem with my very simple implementation of a file chooser dialogue that requires me to minimize Netbeans each time in order to get to it, and it gets pretty frustrating specially now with testing. I have seen a few solutions…
Carlos
  • 5,405
  • 21
  • 68
  • 114
21
votes
1 answer

How to use Open File Dialog to Select a Folder

Possible Duplicate: How do you configure an OpenFileDIalog to select folders? I'm using C# and I want to completely avoid SelectFolderDialog to select a folder. Instead, I want to use something closer to a OpenFileDialog just to select a…
Demasterpl
  • 2,103
  • 5
  • 24
  • 32
21
votes
8 answers

Load a bitmap image into Windows Forms using open file dialog

I need to open the bitmap image in the window form using open file dialog (I will load it from drive). The image should fit in the picture box. Here is the code I tried: private void button1_Click(object sender, EventArgs e) { var dialog = new…
raghu
  • 431
  • 2
  • 11
  • 23
21
votes
2 answers

Create filter on html file chooser dialog

Is there a way to show only .xxx files in the default file chooser dialog. xxx may be not-known file types, such as abc, efg etc. I'm using html5 so it may have new support for this type of things. Thanks!
amitdar
  • 917
  • 3
  • 13
  • 35
20
votes
3 answers

How can I make CommonOpenFileDialog select folders only, but still show files?

I am using Microsoft's CommonOpenFileDialog to allow users to select a Folder, but no files are visible when the dialog comes up. Is it possible to show files as well as folders when IsFolderPicker is set to true? My current code looks like this var…
Rachel
  • 130,264
  • 66
  • 304
  • 490
20
votes
5 answers

OpenFileDialog/c# slow on any file. better solution?

I am opening a file using the OpenFileDialog in c# and I am noticing it is taking between 20-40 seconds to load my file and clear the dialog. Here is my sample code: private void btnOpen_Click(object sender, EventArgs e) { if…
rlemon
  • 17,518
  • 14
  • 92
  • 123
19
votes
6 answers

OpenFileDialog C# custom filter like 'ABC*.pdf'

Is it possible to specify custom filters like 'ABC*.pdf' which means: "Show all PDF which starts with ABC"? I can only specify *.pdf, *.doc, *.*, etc. Thanks Florian
user2071938
  • 2,055
  • 6
  • 28
  • 60
18
votes
2 answers

Why the current working directory changes when use the Open file dialog in Windows XP?

I have found an strange behavior when use the open file dialog in c#. If use this code in Windows XP the current working directory changes to the path of the selected file, however if you run this code in Windows 7 the current working directory…
RRUZ
  • 134,889
  • 20
  • 356
  • 483
17
votes
4 answers

Alternative to FolderBrowserDialog

Is there an alternative for selecting folders in C#? Optimally I'd like to use the OpenFileDialog to select folders, or at least something similar to that.
NMunro
  • 1,282
  • 4
  • 18
  • 33
16
votes
5 answers

Open file input dialog and upload onchange possible in IE?

This is basically and simplified what I have now:
Upload…
Rudie
  • 52,220
  • 42
  • 131
  • 173
16
votes
2 answers

Win32 function to OpenFileDialog?

I searching function something like OpenFileDialog on .NET but on win32, i can't find this function on this name on msdn and i remember this function exists. Can anyone give me name? Greetings,
Svisstack
  • 16,203
  • 6
  • 66
  • 100
1
2
3
71 72