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.
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 all files when user right clicks and selects "Open With"
(2 answers)
Closed 5 years ago.
Basically the problem is that I'am trying to open files with the program I made by right clicking on the file and open with... It works fine for a single file but when I try to open multiple files at the same time it starts an instance of the program for each individual file.
Finally, What I'am trying to get to is a way of changing this behavior in order to make one instance of the program handle all files.
Thanks,
You could check to see if there is already an instance of the program running before you initialize the window then send the file path to the open program or something along those lines
You won't like the answer as it gets complex but it is already answered here...
Open all files when user right clicks and selects "Open With"
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.
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 an answer here:
Closed 11 years ago.
Possible Duplicate:
How to select multiple folder path usingt FolderBrowserDialog control in vb.net
I want to select many folders for performing some operations on them, like selecting
many files with OpenFileDialog.
The problem is that I can't select multiple folders in time with FolderBrowseDialog.
What is the solution?
That component doesn't allow multiple selections, sorry. You can, however, enable multiple selections in a TreeView to accomplish the task.
Select it one by one. Or custom control: File Explorer using Treeview controller Here is what you need.
Don't forget to mark answer as correct if that helped you.
OpenFolderDialog, apparently does not support multiple item selection:
How to select multiple folder paths using FolderBrowserDialog control in VB.NET