473,385 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 3098
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Alvin Bruney [MVP] | last post by:
with the using construct, exit from scope calls dispose on said object. But what happens in a connection pooling scenario? Is the run-time smart enough to realize that Object Pooling is being used...
1
by: VJ | last post by:
I am in the last row of my datagrid and in the last but one column. I don't want the user to tab to the last column, but to my save button. How do I accomplish this?, using SelectNextControl does...
6
by: Adrian | last post by:
I want to move to the next text box when enter is pressed. The text boxes are in tab order and start with 0. Could someone please correct the error line for me? Many thanks. private void...
9
by: Hasani \(remove nospam from address\) | last post by:
I was reading a ppt ( http://www.gotdotnet.com/team/pdc/4064/tls310.ppt ) and came aross this statement. "Users can leverage a destructor. The C++ compiler generates all the Dispose code...
1
by: Stan Sainte-Rose | last post by:
I still have a problem using the datagrid with my Class when I press the Tab Key. I add this condition If msg.wparam.ToInt32()=Cint(Keys.tab) Then MyBase.SelectNextControl(Me, True, True, True,...
21
by: Roland | last post by:
The following issue is puzzling me: There are 2 ways of writing the code below: .... Dim fnt as Font = New Font(...) DrawString(myText, fnt,...) fnt.dispose(). or DrawString(myText, New...
4
by: phl | last post by:
hi, My question is: 1. To avoid possible memory leaks, when you use this pattern, after you have dealth with the unmanaged resources and before you take your object off the finalize queue,...
10
by: mg | last post by:
I'm migrating from VB6 and have a question about using 'Using' and the best way to use it. Here is a example of a small bit of code: dbConx("open") Using CN Dim CMD As New OleDbCommand(sSQL,...
7
by: heddy | last post by:
I have an array of objects. When I use Array.Resize<T>(ref Object,int Newsize); and the newsize is smaller then what the array was previously, are the resources allocated to the objects that are...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.