Re: Weird Behavior in ShowDialog()
From: Herfried K. Wagner [MVP] (hirf-spam-me-here_at_gmx.at)
Date: 12/16/04
- Next message: Herfried K. Wagner [MVP]: "Re: DEbug.Print"
- Previous message: Tom Shelton: "Re: System.Net.Sockets Quickie"
- In reply to: Sean: "Weird Behavior in ShowDialog()"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 16 Dec 2004 08:10:22 +0100
"Sean" <anonymous@discussions.microsoft.com> schrieb:
> I have a main window application Form A that calls
> ShowDialog() of Form B in the Click event of Form A.
>
> Sometimes when I hit the cancel button on Form B, Form B
> closes and SURPRISINGLY Form A closes as well (ie. the
> whole application exits).
Maybe assigning 'None' to the button's 'DialogResult' and adding this code
to the button's 'Click' event handler solves the problem:
\\\
Me.DialogResult = DialogResult.Cancel
Me.Close()
///
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
- Next message: Herfried K. Wagner [MVP]: "Re: DEbug.Print"
- Previous message: Tom Shelton: "Re: System.Net.Sockets Quickie"
- In reply to: Sean: "Weird Behavior in ShowDialog()"
- Messages sorted by: [ date ] [ thread ]