I have a question regarding Console Application, how do I open a window similar to this one where it is possible to select a FOLDER?
ItwouldbeafeatureequaltowhatexistsinWindowsFormswhere FolderBrowserDialog .
I use the .NET Framework 4.5.
I have a question regarding Console Application, how do I open a window similar to this one where it is possible to select a FOLDER?
ItwouldbeafeatureequaltowhatexistsinWindowsFormswhere FolderBrowserDialog .
I use the .NET Framework 4.5.
Do this,
Just instantiate and call.
static class Program
{
[STAThread]
static void Main(string[] args)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK)
{
foreach (var path in Directory.GetFiles(fbd.SelectedPath))
{
Console.WriteLine(path); // full path
Console.WriteLine(System.IO.Path.GetFileName(path)); // file name
}
}
}
}
Source: link
YOU MUST ADD TO REF. for System.Windows.Forms
As our friend @Iago Correia Guimarães remembered well.