Link to home
Create AccountLog in
.NET Programming

.NET Programming

--

Questions

--

Followers

Top Experts

Avatar of Kalpesh Chhatrala
Kalpesh Chhatrala🇮🇳

File and Folder Selection DialogBox
Hi,

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.


Avatar of Éric MoreauÉric Moreau🇨🇦


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.FileName);
                directory = Path.GetDirectoryName(ofd.FileName);
            }

Avatar of Kalpesh ChhatralaKalpesh Chhatrala🇮🇳

ASKER

i am familiar with OpenFileDialog  class.

I want to select File and Folder from Dialog box. OpenFileDialog box not allowed to select folder.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of Éric MoreauÉric Moreau🇨🇦

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

ASKER CERTIFIED SOLUTION
Avatar of d_yorkd_york

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of Kalpesh ChhatralaKalpesh Chhatrala🇮🇳

ASKER

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.

Avatar of Éric MoreauÉric Moreau🇨🇦

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

Free T-shirt

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.

Avatar of Éric MoreauÉric Moreau🇨🇦

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
.NET Programming

.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.