469,921 Members | 2,198 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,921 developers. It's quick & easy.

Question on Dispose and SelectNextControl

Hey guys,

I'm having some weird issues when calling Dispose on one of the controls in
a user control from an asycn or sync method. When called form an async
method Dispose makes a call to SelectNextControl but not when called from a
sync method. I'm trying to figure out why that is so.

Does anyone know under what conditions Dispose will call SelectNextControl?

I have a breakpoint set on the user controls OnValidated method and when the
dispose is called async I see the below stack trace. When called sync the
breakpoint is not hit (since the user control doesn't lose focus from a
SelectNextControl call).

Here is a sample stack trace:

system.windows.forms.dll!System.Windows.Forms.Cont rol::Select(bool directed
= true, bool forward = true) + 0x32 bytes

system.windows.forms.dll!System.Windows.Forms.Cont rol::SelectNextControl(System.Windows.Forms.Contro l
ctl = {Controls.Common.AmountControl}, bool forward = true, bool tabStopOnly
= true, bool nested = true, bool wrap = false) + 0xba bytes

system.windows.forms.dll!System.Windows.Forms.Cont ainerControl::Select(bool
directed = true, bool forward = true) + 0x9d bytes

system.windows.forms.dll!System.Windows.Forms.Cont rol::SelectNextControl(System.Windows.Forms.Contro l
ctl = {Quote.Controls.QuoteControlAdv}, bool forward = true, bool tabStopOnly
= true, bool nested = true, bool wrap = true) + 0xba bytes

system.windows.forms.dll!System.Windows.Forms.Cont ainerControl::AfterControlRemoved(System.Windows.F orms.Control
control = {Calendar.Controls.PopupCalendar}) + 0x186 bytes

system.windows.forms.dll!System.Windows.Forms.Cont rol::ControlCollectionRemove(System.Windows.Forms. Control
value = {Calendar.Controls.PopupCalendar}) + 0x102 bytes
system.windows.forms.dll!System.Windows.Forms.Cont rol::Dispose(bool
disposing = true) + 0x1db bytes

system.windows.forms.dll!System.Windows.Forms.Cont ainerControl::Dispose(bool
disposing = true) + 0x2f bytes
Sep 11 '06 #1
1 2961
It calls it if the control your are disposing or one of its decendant
controls is the active control on the form.

Ciaran O'Donnell

"Flack" wrote:
Hey guys,

I'm having some weird issues when calling Dispose on one of the controls in
a user control from an asycn or sync method. When called form an async
method Dispose makes a call to SelectNextControl but not when called from a
sync method. I'm trying to figure out why that is so.

Does anyone know under what conditions Dispose will call SelectNextControl?

I have a breakpoint set on the user controls OnValidated method and when the
dispose is called async I see the below stack trace. When called sync the
breakpoint is not hit (since the user control doesn't lose focus from a
SelectNextControl call).

Here is a sample stack trace:

system.windows.forms.dll!System.Windows.Forms.Cont rol::Select(bool directed
= true, bool forward = true) + 0x32 bytes

system.windows.forms.dll!System.Windows.Forms.Cont rol::SelectNextControl(System.Windows.Forms.Contro l
ctl = {Controls.Common.AmountControl}, bool forward = true, bool tabStopOnly
= true, bool nested = true, bool wrap = false) + 0xba bytes

system.windows.forms.dll!System.Windows.Forms.Cont ainerControl::Select(bool
directed = true, bool forward = true) + 0x9d bytes

system.windows.forms.dll!System.Windows.Forms.Cont rol::SelectNextControl(System.Windows.Forms.Contro l
ctl = {Quote.Controls.QuoteControlAdv}, bool forward = true, bool tabStopOnly
= true, bool nested = true, bool wrap = true) + 0xba bytes

system.windows.forms.dll!System.Windows.Forms.Cont ainerControl::AfterControlRemoved(System.Windows.F orms.Control
control = {Calendar.Controls.PopupCalendar}) + 0x186 bytes

system.windows.forms.dll!System.Windows.Forms.Cont rol::ControlCollectionRemove(System.Windows.Forms. Control
value = {Calendar.Controls.PopupCalendar}) + 0x102 bytes
system.windows.forms.dll!System.Windows.Forms.Cont rol::Dispose(bool
disposing = true) + 0x1db bytes

system.windows.forms.dll!System.Windows.Forms.Cont ainerControl::Dispose(bool
disposing = true) + 0x2f bytes
Sep 12 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Alvin Bruney [MVP] | last post: by
1 post views Thread by VJ | last post: by
6 posts views Thread by Adrian | last post: by
9 posts views Thread by Hasani \(remove nospam from address\) | last post: by
1 post views Thread by Stan Sainte-Rose | last post: by
21 posts views Thread by Roland | last post: by
4 posts views Thread by phl | last post: by
7 posts views Thread by heddy | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.