Twullf
Mechanical
- Jan 24, 2012
- 196
I have tried this in two different ways.
As well as
The first has no reaction when the cancel button is used and the second hits the error regardless of whether the cancel button is hit or not.
Any help with this would be greatly appreciated.
Code:
Try
Dim dialog As new FolderBrowserDialog()
dialog.description = "Select Directory containing loft data."
strDir = dialog.ShowDialog()
strDir = dialog.SelectedPath
Catch E As Exception
MessageBox.Show("Program cannot continue without lofting data location.", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
As well as
Code:
Dim dialog As new FolderBrowserDialog()
dialog.description = "Select Directory containing loft data."
strDir = dialog.ShowDialog()
strDir = dialog.SelectedPath
On Error GoTo DirCanceledError
.
.
.
DirCanceledError:
'------------------------------------------------------------------------------------------
' If the user cancels the Directory Form, Exit the program
'------------------------------------------------------------------------------------------
MessageBox.Show("Program cannot continue without lofting data location.", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
The first has no reaction when the cancel button is used and the second hits the error regardless of whether the cancel button is hit or not.
Any help with this would be greatly appreciated.