Returning the button pressed from a FolderBrowserDialog

  • Thread starter Thread starter OutdoorGuy
  • Start date Start date
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!
 
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!
 
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!
 
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
///
 
Back
Top