This question already has an answer here:
Setting default folder for openfile dialog
(1 answer)
Closed 8 years ago.
for suppose
When i use OpenFIleDialog.show() in general it Opens by default to Documents.
but i want to change that to mygiven path c:\project\
so when i do OpenFIleDialog.show() it must defaultly open to C:\project\
how can i achieve this
You just need to set the initialdirectory property.
openFileDialog1.InitialDirectory = #"C:\project";
Use InitiaDirectory property of the OpenFileDialog before call the show method.
Related
This question already has answers here:
Opening multiple files (OpenFileDialog, C#)
(2 answers)
Closed 3 years ago.
I need to select multiple files from the browse button. Right now, my code only selects one file. I need to select multiple files (by pressing control on Windows or command on Mac) and process them individually.I want a file per each line in my textbox.
OpenFileDialog has a Multiselect property.
Add this into your code(before showing the dialog).
fd.Multiselect = true;
This question already has answers here:
Open file with associated application
(3 answers)
Closed 5 years ago.
I have a string of the file path and I want to open the file. Not in the way that it shows bytes in the console for example, but to open the original file with the program that suits him.
For example if my path shows a .docs file I want it to be opened with Word.
Any suggestions?
System.Diagnostics.Process.Start("CMD.exe",filePath);
This question already has answers here:
Where does Windows store its "Open With" settings?
(3 answers)
Closed 9 years ago.
I have a little bit confusing problem. I'm not a beginner but I don't know how to do it..
For example I've written a program like notepad from which you can open files, save and etc. But when I set any custom format like ".blabla" to be opened by my app it is not working, so how can I make it to be opened by my app?
It is in WinForms
You need an entry in the registry for custom file extensions. You can try inserting a key in the registry as follows:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\
This question already has answers here:
Can OpenFileDialog automatically select the file with the value set in FileName if InitialDirectory is set as well?
(2 answers)
Closed 2 years ago.
In C#, once an OpenFileDialog is opened in a specific directory, I would like to be able to set which file in the list is selected (highlighted) as though it had been single-clicked. This will help users remember where they "left off" if they happen to use this dialog multiple times in a row to select sequential files.
Does C# offer a way to do this? Do I need to use a lower-level construct?
You can simply set the FileName property.
This question already has answers here:
Embed a File Chooser in a UserControl / Form
(2 answers)
Closed 4 years ago.
How can I embed the FolderBrowserDialog into my "form1"?
I don't want a popup dialog, how can I achieve this?
You need to implement your own coding for doing so. It is rather easy, you can use some TreeViews and ListViews and use File Path and other stuff from System.IO class.
It is not possible to embed the FolderBrowserDialog in your own form, but you can use 3rd party controls like Shell MegaPack to do this.
DISCLAIMER: I work for LogicNP Software, the developer of Shell MegaPack.