.NET Programming
--
Questions
--
Followers
Top Experts
File and Folder Selection DialogBox
Hi,
I want to select file and folder (both at a time) using C#.
please help me
thanks.
I want to select file and folder (both at a time) using C#.
please help me
thanks.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
do you know the OpenFileDialog class? Check https://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog%28v=vs.110%29.aspx
include a "using System.IO" and use Path from it - quick example:
OpenFileDialog ofd = new OpenFileDialog();
DialogResult dr = ofd.ShowDialog();
string filename = "";
string directory = "";
if (dr == DialogResult.OK)
{
filename = Path.GetFileName(ofd.FileN ame);
directory = Path.GetDirectoryName(ofd. FileName);
}
OpenFileDialog ofd = new OpenFileDialog();
DialogResult dr = ofd.ShowDialog();
string filename = "";
string directory = "";
if (dr == DialogResult.OK)
{
filename = Path.GetFileName(ofd.FileN
directory = Path.GetDirectoryName(ofd.
}
i am familiar with OpenFileDialog class.
I want to select File and Folder from Dialog box. OpenFileDialog box not allowed to select folder.
I want to select File and Folder from Dialog box. OpenFileDialog box not allowed to select folder.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
I am not sure to understand. The OpenFileDialog let you pick a folder and then a file from that folder no? See the attached image.
OpenFileDialog.PNG
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
thanks d_york.
i understand i need to design this type of dialog box.
do you know this type of dialogbox (file and folder select functionality) available in free ?
thanks for reply.
i understand i need to design this type of dialog box.
do you know this type of dialogbox (file and folder select functionality) available in free ?
thanks for reply.
So the file you select is not related to the selected folder. Right?
This is a specific need and you will need to create your own dialog.
I have some code that creates the folders structure in a treeview: http://emoreau.com/Entries/Articles/2006/03/Folders-synchronization-using-the-SystemIO-namespace.aspx
This is a specific need and you will need to create your own dialog.
I have some code that creates the folders structure in a treeview: http://emoreau.com/Entries/Articles/2006/03/Folders-synchronization-using-the-SystemIO-namespace.aspx

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
I do not know of any free control that provides that functionality.
that suggested comment is not providing a solution for this question!
the solution (building a custom dialog to show folders) is available from https:#40680329
the solution (building a custom dialog to show folders) is available from https:#40680329
.NET Programming
--
Questions
--
Followers
Top Experts
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.