Returning the button pressed from a FolderBrowserDialog

O

OutdoorGuy

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!
 
S

Stephany Young

Ummmmmmmmm ...

If Me.FolderBrowserDialog1.ShowDialog() = DialogResult.Cancel Then
...
End If


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!
 
M

Mudhead

If FolderBrowserDialog1.ShowDialog() = 2 Then
Debug.WriteLine("canceled")
Else
' -- Whatever
End If
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!
 
H

Herfried K. Wagner [MVP]

OutdoorGuy said:
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
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top