On Sun, 31 Jul 2005 23:57:43 -0400, Chris <no@spam.com> wrote:
dgk wrote: I'm showing a form using ShowDialog (VB2003 in Visual Studio), and a
button on that form pops up a FolderBrowserDialog. As soon as the FBD
is closed, either by selecting or by cancel, the form exits. Not the
behavior that I was hoping for. Did I mess something up or is this the
way that it works?
Can we see some simplified code that shows the problem?
chris
In the main form (during load if app settings aren't created yet):
Dim frmOptions As New frmOpts
Dim RCF As DialogResult = frmOptions.ShowDialog
If RCF = DialogResult.Cancel Then Environment.Exit(1)
frmOptions.Close()
In frmOptions I declare this:
Private FBD As New System.Windows.Forms.FolderBrowserDialog
and in a button click event do this:
Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnBrowse.Click
FBD.ShowNewFolderButton = True
Dim J As DialogResult = FBD.ShowDialog
End Sub
Click on the button, the Folder dialog pops up. Click either Ok or
Cancel and the folderbrowser exits, and so does the form. I can likely
stop it in OnClosing since that code is certainly firing, but I have
no idea why it is happening.