Click here to Skip to main content
15,894,825 members
Home / Discussions / C#
   

C#

 
QuestionWhat causes the close button to stop working? Pin
vektuz5-Dec-03 23:04
vektuz5-Dec-03 23:04 
AnswerRe: What causes the close button to stop working? Pin
vektuz5-Dec-03 23:25
vektuz5-Dec-03 23:25 
GeneralRe: What causes the close button to stop working? Pin
Heath Stewart6-Dec-03 5:12
protectorHeath Stewart6-Dec-03 5:12 
GeneralRe: What causes the close button to stop working? Pin
Nick Parker6-Dec-03 8:52
protectorNick Parker6-Dec-03 8:52 
GeneralRe: What causes the close button to stop working? Pin
vektuz6-Dec-03 10:10
vektuz6-Dec-03 10:10 
GeneralRe: What causes the close button to stop working? Pin
Heath Stewart6-Dec-03 10:17
protectorHeath Stewart6-Dec-03 10:17 
GeneralRe: What causes the close button to stop working? Pin
vektuz6-Dec-03 10:28
vektuz6-Dec-03 10:28 
GeneralRe: What causes the close button to stop working? Pin
vektuz6-Dec-03 11:00
vektuz6-Dec-03 11:00 
I've narrowed it down and found the line thats causing it.

Situation: I have a panel (TargetPanel) which has had a user control (m_MyPanel) added to it.
I want to make the panel blank again.

The following is done:

TargetPanel.Controls.Remove(m_MyPanel);
m_MyPanel.Dispose();
m_MyPanel = null;

If instead I just do this:

m_MyPanel.Dispose();
m_MyPanel = null;

It works fine.

I'm guessing that at the time of Controls.Remove(...), mypanel isnt actually in the list of controls (removed for some reason by another part of the program, although, since its a private member, thats hard to explain)... and thus it causes bad things to occur.

However, there are no unhandled exceptions or any other kind of debug / bad messages, so its odd...

However, its 'fixed' now.

I'd still like to get to the bottom of it so I know whats wrong.

GeneralInvertRegion Pin
mhmoud rawas5-Dec-03 22:09
mhmoud rawas5-Dec-03 22:09 
GeneralRe: InvertRegion Pin
Alex Korchemniy6-Dec-03 7:53
Alex Korchemniy6-Dec-03 7:53 
GeneralRe: InvertRegion Pin
mhmoud rawas6-Dec-03 8:40
mhmoud rawas6-Dec-03 8:40 
GeneralRe: InvertRegion Pin
J. Dunlap6-Dec-03 9:42
J. Dunlap6-Dec-03 9:42 
GeneralRe: InvertRegion Pin
mhmoud rawas6-Dec-03 18:00
mhmoud rawas6-Dec-03 18:00 
GeneralRe: InvertRegion Pin
J. Dunlap7-Dec-03 14:56
J. Dunlap7-Dec-03 14:56 
GeneralJPG Size Pin
mhmoud rawas5-Dec-03 22:07
mhmoud rawas5-Dec-03 22:07 
GeneralRe: JPG Size Pin
Heath Stewart6-Dec-03 4:57
protectorHeath Stewart6-Dec-03 4:57 
GeneralRe: JPG Size Pin
Anonymous6-Dec-03 6:23
Anonymous6-Dec-03 6:23 
GeneralRe: JPG Size Pin
Heath Stewart6-Dec-03 6:44
protectorHeath Stewart6-Dec-03 6:44 
GeneralRe: JPG Size Pin
mhmoud rawas6-Dec-03 7:22
mhmoud rawas6-Dec-03 7:22 
GeneralRe: JPG Size Pin
mhmoud rawas6-Dec-03 7:24
mhmoud rawas6-Dec-03 7:24 
GeneralRe: JPG Size Pin
mhmoud rawas6-Dec-03 7:17
mhmoud rawas6-Dec-03 7:17 
GeneralFile Size over Internet Pin
eggie55-Dec-03 21:06
eggie55-Dec-03 21:06 
GeneralRe: File Size over Internet Pin
leppie5-Dec-03 21:51
leppie5-Dec-03 21:51 
GeneralRe: File Size over Internet Pin
Heath Stewart6-Dec-03 4:50
protectorHeath Stewart6-Dec-03 4:50 
GeneralRe: File Size over Internet Pin
eggie56-Dec-03 11:20
eggie56-Dec-03 11:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.