MDI Child Form Not Releasing DataSet

M

Mark Olbert

I have an application that creates MDI child windows to edit different datatables in the same
dataset.

At one point in the application cycle, users have the opportunity to log off the database server (so
they can reconnect to a different one). As part of that log off, I clear the dataset.

Unfortunately, if an MDI child form has been opened and then closed, the datatable for that form
hangs on the clear (i.e., aDataTable.Clear() stalls forever). This problem does not occur if that
table's form has not been opened and closed.

This seems to be a problem where the MDI child form, while "closed", is still maintaining a
reference to the datatable (probably through databinding?).

How do I get rid of this reference so that datatable can be cleared? I've tried setting the
MDIParent property of the MDIChild form to null in an event handler for the MDIParent form that
watches for MDIChild Close events, followed by a call to MDIChild.Dispose(). Unfortunately, that
does't solve the problem.

Any leads or workarounds would be greatly appreciated.

- Mark

p.s. BTW, this is looks to be the second "silent failure" of the NET Framework I've come across in
the past week (the first had to do with the way the Framework's handling of DBNull values for bound
DateTimePicker controls breaks the BindingContext.Position code, with no outward sign of a problem).
I'm beginning to think the NET Framework design team didn't take enough advantage of exception
handling in developing the Framework.
 
Y

Ying-Shen Yu[MS]

Hi Mark,
Are you using some data-binding controls in your MDI Child Form? I
think you may try set the
databinding properties to null in your OnClosed event handler of your MDI
Child Form.
Thanks, if you still have problem, please let me know.

Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| NNTP-Posting-Date: Mon, 08 Sep 2003 20:49:52 -0500
| From: Mark Olbert <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| Subject: MDI Child Form Not Releasing DataSet
| Date: Mon, 08 Sep 2003 18:49:53 -0700
| Organization: Olbert & McHugh, Ltd.
| Reply-To: (e-mail address removed)
| Message-ID: <[email protected]>
| X-Newsreader: Forte Agent 1.93/32.576 English (American)
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Lines: 28
| X-Trace:
sv3-XtpVl+EKeCA0SDB02LP4/+UvTGMFg0K+ROtW2I589Nr8almFVxzyHVnTPpG+3bFNquU2vMhe
jJvNbkF!8uy/+RuKcSuUqncziwsXb0MHUOmF/nMT8/bfxtCgxBmfF9RXZ8xEqmnMFVeazGkS3VEz
Fw==
| X-Complaints-To: (e-mail address removed)
| X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
| X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
| X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
| X-Postfilter: 1.1
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!news-lei1.dfn.de!news-fra1.dfn.de!npeer.de.kpn-eurorings.net!news-xfer.
cox.net!peer01.cox.net!cox.net!border3.nntp.aus1.giganews.com!intern1.nntp.a
us1.giganews.com!nntp.giganews.com!news.giganews.com.POSTED!not-for-mail
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51907
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| I have an application that creates MDI child windows to edit different
datatables in the same
| dataset.
|
| At one point in the application cycle, users have the opportunity to log
off the database server (so
| they can reconnect to a different one). As part of that log off, I clear
the dataset.
|
| Unfortunately, if an MDI child form has been opened and then closed, the
datatable for that form
| hangs on the clear (i.e., aDataTable.Clear() stalls forever). This
problem does not occur if that
| table's form has not been opened and closed.
|
| This seems to be a problem where the MDI child form, while "closed", is
still maintaining a
| reference to the datatable (probably through databinding?).
|
| How do I get rid of this reference so that datatable can be cleared? I've
tried setting the
| MDIParent property of the MDIChild form to null in an event handler for
the MDIParent form that
| watches for MDIChild Close events, followed by a call to
MDIChild.Dispose(). Unfortunately, that
| does't solve the problem.
|
| Any leads or workarounds would be greatly appreciated.
|
| - Mark
|
| p.s. BTW, this is looks to be the second "silent failure" of the NET
Framework I've come across in
| the past week (the first had to do with the way the Framework's handling
of DBNull values for bound
| DateTimePicker controls breaks the BindingContext.Position code, with no
outward sign of a problem).
| I'm beginning to think the NET Framework design team didn't take enough
advantage of exception
| handling in developing the Framework.
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top