Microsoft KB Archive/893142

= A memory leak may occur when a Windows Forms-based application uses the MonthCalendar control, the DateTimePicker control, and the NumericUpDown control in a .NET Framework 1.1 application =

Article ID: 893142

Article Last Modified on 5/18/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.1

-





SYMPTOMS
A memory leak may occur when a Microsoft Windows Forms-based application uses the following controls:
 * MonthCalendar
 * DateTimePicker
 * NumericUpDown

This problem occurs in the Microsoft .NET Framework 1.1.



CAUSE
This problem occurs because the MonthCalendar control, the DateTimePicker control, and the NumericUpDown control listen for system events. Therefore, these controls must be explicitly disposed before their parent forms are disposed. If you do not explicitly dispose these controls, a memory leak may occur.



RESOLUTION
To resolve this problem, you must explicitly dispose these controls by using the Dispose method. For example, to explicitly dispose the MonthCalendar control, you can use the '''MonthCalendar. Dispose''' method.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
For more information about these controls, visit the following Microsoft Developer Network (MSDN) Web sites:

MonthCalendar class

http://msdn2.microsoft.com/en-us/library/system.windows.forms.monthcalendar(vs.71).aspx

DateTimePicker class

http://msdn2.microsoft.com/en-us/library/system.windows.forms.datetimepicker(vs.71).aspx

NumericUpDown class

http://msdn2.microsoft.com/en-us/library/system.windows.forms.numericupdown(vs.71).aspx

Keywords: kbmemory kbprogramming kbcontrol kbwindowsforms kbbug kbtshoot kbprb KB893142

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.