Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Nov 18th, 2005, 3:21 PM   #1
MBirchmeier
Hobbyist Programmer
 
Join Date: Oct 2005
Posts: 211
Rep Power: 3 MBirchmeier is on a distinguished road
.NET Timer Form closing issue

This question pertains specifically to the .NET Compact framework version 1.1.

The problem is using Timers with the Form.ShowDialog() and Form.Close() command.

When a timer is created on a form with the Form.Show() command it is attached to the form, so that the form will stop and (supposedly) close the timer when the form is destroyed, however with the ShowDialog command is used.

However when using the ShowDialog command the timer is attached differently to the form so that it can keep running after the form has been closed, and in some cases even destroyed. (note: We can't use Show instead of ShowDialog() for various other reasons, notably our dynamic creations of forms from a database tends to issues with Form.Show())

This causes two problems.

First we'll occasionally have a timer run, that because the form underneath it has been destroyed, that will cause various unhandled null reference exceptions and the like.

Secondly : Even if the timer is not running, it appears that it is never getting destroyed, since that is normally handled in the form destruction code. (Or the code will keep running, without causing an exception) causing a small possibly undetectable memory leak. (This code is designed to run for months if not years at a time, a small memory leak can be substancial, we've ran tests of several weeks at a time without problem, but a leak this small we might not be able to detect over such a small period of time)

Is there a way to force the timers destruction with the destruction or closing of the form? Additionally is there a way to automate this process to prevent from having to individually evaluate each form.

Thanks,
-MBirchmeier
MBirchmeier is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:36 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC