By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,034 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,034 IT Pros & Developers. It's quick & easy.

Returning the button pressed from a FolderBrowserDialog

P: n/a
Greetings,

I have the following code in a VB.NET Windows application and was
wondering if there is any way to determine whether or not the user
pressed the "Cancel" button on the FolderBrowerseDialog?

Me.FolderBrowserDialog1.ShowDialog()

I tried dimensioning "x" as a boolean variable and using the statement
below, but it returned "true" regardless of what button was pressed.
Any ideas?

x = Me.FolderBrowserDialog1.ShowDialog()

Thanks in advance!

*** Sent via Developersdex http://www.developersdex.com ***

Dec 20 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Ummmmmmmmm ...

If Me.FolderBrowserDialog1.ShowDialog() = DialogResult.Cancel Then
...
End If
"OutdoorGuy" <Ou********@fishing.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Greetings,

I have the following code in a VB.NET Windows application and was
wondering if there is any way to determine whether or not the user
pressed the "Cancel" button on the FolderBrowerseDialog?

Me.FolderBrowserDialog1.ShowDialog()

I tried dimensioning "x" as a boolean variable and using the statement
below, but it returned "true" regardless of what button was pressed.
Any ideas?

x = Me.FolderBrowserDialog1.ShowDialog()

Thanks in advance!

*** Sent via Developersdex http://www.developersdex.com ***
Dec 20 '06 #2

P: n/a
If FolderBrowserDialog1.ShowDialog() = 2 Then
Debug.WriteLine("canceled")
Else
' -- Whatever
End If
"OutdoorGuy" <Ou********@fishing.comwrote in message news:%2****************@TK2MSFTNGP04.phx.gbl...
Greetings,

I have the following code in a VB.NET Windows application and was
wondering if there is any way to determine whether or not the user
pressed the "Cancel" button on the FolderBrowerseDialog?

Me.FolderBrowserDialog1.ShowDialog()

I tried dimensioning "x" as a boolean variable and using the statement
below, but it returned "true" regardless of what button was pressed.
Any ideas?

x = Me.FolderBrowserDialog1.ShowDialog()

Thanks in advance!

*** Sent via Developersdex http://www.developersdex.com ***

Dec 20 '06 #3

P: n/a

Thanks. That worked great!
*** Sent via Developersdex http://www.developersdex.com ***
Dec 20 '06 #4

P: n/a
"OutdoorGuy" <Ou********@fishing.comschrieb:
I have the following code in a VB.NET Windows application and was
wondering if there is any way to determine whether or not the user
pressed the "Cancel" button on the FolderBrowerseDialog?

Me.FolderBrowserDialog1.ShowDialog()
\\\
Imports WinForms = System.Windows.Forms
....
If _
Me.FolderBrowserDialog1.ShowDialog() = _
WinForms.DialogResult.Cancel _
Then
...
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Dec 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.