Search:
Namespaces
Discussions
.NET v1.1
Feedback
Win App will not close
Messages
Related Types
This message was discovered on
ASPFriends.com 'winforms-cs' list
.
Robm
-- Copied from [winforms-vb] to [winforms-cs] by Tony Stark <
Click here to reveal e-mail address
> --
(Note: Could this be placed into the C# winforms forum also -- could not fi=
nd the forum email address)
Hello
I have a windows app inwhich I am creating the controls dynamically as need=
ed onto a content panel. As the user flips from page to page, I clear the c=
ontrols, then add new controls to this panel using the code below...
// clear controls
panel.Controls.Clear();
panel.Invalidate();
// add controls
Panel
.Controls.Add(theControl);
The problem:
After I have cleared, then added new controls, the X (Top right hand corner=
) will not work to shutdown my application. Even if I hook up a button to s=
hut down the app, it still does not work. (Seems to ignore the command) The=
only way that I can shut down the application is to Ctrl-Alt-delete from w=
ithin windows, or within the VS.Net console, to shut it down using the stop=
within the debugger.
Note: My app still responds to user interaction and I am able to continue u=
sing the application as needed.
I assume that it has something to do with how I am clearing the controls, b=
ut I do not know of a solution. Any help would be greatly appreciated.
Robert
Reply to this message...
Erik Brown
Rob,
This is known bug in the current framework. Make sure you dispose of
your controls before you close the form (in an OnClosing method
override, for example), and it will usually work. The problem occurs
when a deleted control has the focus when the window is closed, so
changing the focus to the form itself or some other known control will
work as well.
Erik
========
Erik Brown
Author of "Windows Forms Programming with C#"
http://www.amazon.com/exec/obidos/ASIN/1930110286
[Original message clipped]
Reply to this message...
Robm
Thanks Eric
I changed the focus to another control that I was not deleted and it now wo=
rks perfectly.
Robert Merriott
>>>
Click here to reveal e-mail address
07/14/02 05:28PM >>>
Rob,
This is known bug in the current framework. Make sure you dispose of
your controls before you close the form (in an OnClosing method
override, for example), and it will usually work. The problem occurs
when a deleted control has the focus when the window is closed, so
changing the focus to the form itself or some other known control will
work as well.
Erik
=3D=3D=3D=3D=3D=3D=3D=3D
Erik Brown
Author of "Windows Forms Programming with C#"
http://www.amazon.com/exec/obidos/ASIN/1930110286=20
=20
[Original message clipped]
| [winforms-cs] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/winforms-cs.asp
=3D JOIN/QUIT
Reply to this message...
System.Windows.Forms.Panel
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com