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
6
votes
2 answers

How Path.GetDirectoryName Works?

When i use OpenFileDialog to Open file, of course i need to get the file directory and its name to load the file.(to load xml, to access the file i need full path.) opd is OpenFileDialog if (opd.ShowDialog() == true) { …
M.kazem Akhgary
  • 18,645
  • 8
  • 57
  • 118
6
votes
1 answer

OpenFileDialog doesn't show

I have this simple code: private void buttonOpen_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { textBox2.Text = openFileDialog1.FileName; } } When I run program form doesn't show and…
user3536856
  • 61
  • 1
  • 4
6
votes
3 answers

How do I get a single file name out of a File Dialog object in VBA (for MS Access 2007)?

How do I change my code to get the file name instead of the directory name? openDialog.InitialFilename gives me the directory name. openDialog.FileName gives me the error "Method or data member not found". Private Sub btnEditPhoto_Click() If…
Christopher Bottoms
  • 11,218
  • 8
  • 50
  • 99
6
votes
3 answers

Changing/Adding controls to the windows Open/Save common dialog

Is there a way of changing/adding to the windows Open/Save common dialog to add extra functionality? At work we have an area on a server with hundreds of 'jobfolders'- just ordinary windows folders created/managed automatically by the database…
ajp
  • 195
  • 8
6
votes
2 answers

How to disable file in use check in WPF OpenFileDialog?

My WPF app is using the Microsoft.Win32.OpenFileDialog to select a SQL Server 2008 database to open. It works OK but for one issue: When the database selected in the dialog was previously opened at some time since last boot, the file seems to be…
Liell
  • 193
  • 1
  • 8
6
votes
4 answers

Getting filesize from OpenFileDialog?

How can I get the filesize of the currently-selected file in my Openfiledialog?
Mary
  • 581
  • 4
  • 8
  • 16
5
votes
6 answers

Excluding file extensions from open file dialog in C#

I am trying to put a filter on my C# openFileDialog that excludes certain file extensions. For example I want it to show all files in a directory that are not .txt files. Is there a way to do this?
user113872
5
votes
4 answers

C# Don't display filter extensions in OpenFileDialog

I have multiple extensions in the Filter property of OpenFileDialog. Is possible to hide the extensions and show only the description? Sample: dialog.Filter = "Image files|*.bmp;*.jpg; many image file extensions here" I want to show only the text:…
Mircea Ispas
  • 20,260
  • 32
  • 123
  • 211
5
votes
1 answer

Why does OpenFileDialog freeze WinForms app on a specific machine?

I have a WinForms app deployed to multiple machines in the same office. Up until this Monday, all users in the office used the app without issue and used the OpenFileDialog to select files to import. One machine had lots of updates to other apps and…
flipdoubt
  • 13,897
  • 15
  • 64
  • 96
5
votes
1 answer

How to know the number of Files opened by OpenFileDialog

I can retrieve the names of individual files and also I can use count in the looping code to get the required value, but is it possible to know this without the iteration. Perhaps, a Property is defined for that.
Shamim Hafiz - MSFT
  • 21,454
  • 43
  • 116
  • 176
5
votes
2 answers

Windows dialogs with large fonts

I'm consulting on a large .Net winforms project that has to be able to run in "Touch" mode so it can be operated using a touch screen interface. The application architecture already contains scaling logic for enlarging the fonts/display on the…
5
votes
1 answer

OpenFileDialog does not show complete filename in Windows 7

OpenFileDialog does not show complete filename in Windows 7. The problem is also reported connect.microsoft.com. There is also a work around by setting openFileDialog.AutoUpgradeEnabled = false. But that causes old xp style dialog. Is there any way…
particle
  • 3,280
  • 4
  • 27
  • 39
5
votes
1 answer

A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in WindowsBase.dll

I have a .NET 4.0 WPF project. When I open a FileDialog, choose some files and press the OK button, then I see in the output window this error: A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in…
msfanboy
  • 5,273
  • 13
  • 69
  • 120
5
votes
1 answer

OpenFileDialog returns empty string on paths over 260 characters (or doesn't return at all)

I'm writing a program that needs to read in files from anywhere on the system. Some users of the program have paths over the 260 character limit. The OpenFileDialog doesn't work with files with paths over 260 characters. I've tried using both…
cdicker
  • 69
  • 5
5
votes
1 answer

Why am I getting this exception when using CommonOpenFileDialog in a Console Application?

The Problem I'm trying to use CommonOpenFileDialog's folder picker, as described in this answer. The problem is that even with a very stripped down example project I get an exception when trying to use CommonOpenFileDialog's ShowDialog()…
Obscerno
  • 193
  • 5
  • 16