Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FolderBrowserDialog in WPF app
Message
From
07/03/2014 08:44:41
 
 
To
07/03/2014 08:04:31
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Environment versions
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01595925
Message ID:
01595926
Views:
48
This message has been marked as the solution to the initial question of the thread.
>Hi,
>
>I'm using C# in a WPF application and need to display a windows dialog to let the user specify a folder to use.
>
>This code works in displaying the folder, but I get an error when testing the return result of the dialog:
>
>
            FolderBrowserDialog fdlg = new FolderBrowserDialog();
>            //fdlg.ShowNewFolderButton = false;
>            fdlg.Description = "Select Folder to save the Zip file";
>            fdlg.RootFolder = System.Environment.SpecialFolder.MyDocuments;
>            //fdlg.RootFolder = Environment.SpecialFolder.Desktop;             fdlg.ShowDialog();
>            DialogResult result = fdlg.ShowDialog();
>
>            if (result == DialogResult.OK)
>
>The error occurs on the OK in the final line above (everything else is fine) and is:
>
>
'System.Nullable<bool>' does not contain a definition for 'OK' and no extension method 'OK' accepting a first argument of type 'System.Nullable<bool>' could be found (are you missing a using directive or an assembly reference?)
>
>any ideas what I'm missing or an alternative technique?

FolderBrowserDialog is in System.Windows.Forms and returns a System.Windows.Forms.DialogResult ( not a System.Windows.DialogResult). You probably need :
if (result == System.Windows.Forms.DialogResult.OK)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform