![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I am seeing these ObjectDisposedExceptions very infrequently, but I am seeing them. They are being thrown on a button/control which are part of a form; e.g. this.button.ForeColor = Color.Black throws (very infrequently). I definitely do not dispose of the form or these buttons before the exception is thrown. I add the button like: "this.button.Parent = this". Obviously I am still holding a reference to the control, and I definitely do not dispose of the control or the form (I dispose of the form when exiting the app and definitely have not got there yet). The latest exception occured when a user tapped on a button and the app went to change the colors of other buttons on the page by setting their ForeColor and BackColor - seems innocent enough. As a developer, when unexplained things happen, you start questioning even the smallest thing, so today's question is: Is "this.button.Parent = this" *exactly* the same as "this.Controls.Add (this.button)". I use the former because it is faster. See http://msdn2.microsoft.com/en-us/library/aa446535.aspx I do call SendToBack and BringToFront on the form when required, but that's just a Z-order thing and should not dispose of controls/buttons. Any ideas or known bugs in the CF to make this happen? Very curious... Hilton |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |