This question already has answers here:
Open directory dialog
(16 answers)
Closed 9 years ago.
I have a WPF application that I need to have users access directories in. I have searched to the end of the world on how to integrate windows forms into WPF and have found all kinds of information on how to integrate form controls into my xaml, however, integrating a FolderBrowserDialog.
I am veteran programmer, but very new to .net (2nd day in fact), and I believe I can not find good information on immplementing this simply because I can not determine what the name/type is for a FolderBrowserDialog.
Oh, and I am using c# and Visual Studio 2008
You need to add a reference to System.Windows.Forms.dll, then use the System.Windows.Forms.FolderBrowserDialog class.
Adding using WinForms = System.Windows.Forms; will be helpful.
If I'm not mistaken you're looking for the FolderBrowserDialog (hence the naming):
var dialog = new System.Windows.Forms.FolderBrowserDialog();
System.Windows.Forms.DialogResult result = dialog.ShowDialog();
Also see this SO thread: Open directory dialog
Related
This question already has answers here:
Check if an executable exists in the Windows path
(8 answers)
Closed 3 years ago.
I am working on a WPF app, and I would like to include a button that directs it to another app. I would like it to have the following functionality:
If the app is installed on the user's computer, it opens the app for them.
If the app is not yet installed, it sends them to a link where they can download the app.
I know I will need to use Process.Start to open the app, but I am stuck on how to check if the app exists. If anyone could point me in the right direction it would be appreciated!
Two things you can use:
File.Exists(string) - Checks if the file exists.
try-catch - Simply try to open it, and handle any exceptions.
I would probably opt for the first solution...
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:
How can run functions of powercfg by C# code?
(3 answers)
Closed 9 years ago.
From my C# program I want to open the power options from the control panel in Windows.
However I can't seem to find out how to do that, I tried making a shortcut and see where it goes but it is referring to the control panel.
Does anyone have an idea how to do that or where the exe is located to launch?
Try the following:
System.Diagnostics.Process.Start("powercfg.cpl");
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.
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Create Windows 7 Quick Launch
Is there any method to place a shortcut (lnk file) in the quick launch bar of windows 7 using C# code? The method I used for Win XP doesn't work for Win7:
string strAllUsersAppData = Environment.GetEnvironmentVariable("APPDATA");
string strQuickLaunch = strAllUsersAppData;
strQuickLaunch += #"\Microsoft\Internet Explorer\Quick Launch";
//then i used a method to copy the lnk file in the strQuickLaunch path
I don't know how to create the path for it in Win7. Any ideas?
Thanks
See this CodeProject page; I realize its not C#; however, read the Background paragraph to understand a bit more.