473,503 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dispose() in Partial Class

I have been migrating my code from .NET 1.1 framework to .NET 2.0 framework.
With the designer generated code, the Dispose() method is put in the
<Name>.Designer.cs partial class.
How is it possible to add resource cleanup code to a user control/form (as I
used to do in the Dispose() method before partial classes)?

Many thanks.
Feb 10 '06 #1
1 3261
James,

You can always register for the Disposed event. This event is called
only when the Dispose method is called, not when an object is finalized.
You can call Dispose on your resources there.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"JamesB" <Ja****@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
I have been migrating my code from .NET 1.1 framework to .NET 2.0
framework.
With the designer generated code, the Dispose() method is put in the
<Name>.Designer.cs partial class.
How is it possible to add resource cleanup code to a user control/form (as
I
used to do in the Dispose() method before partial classes)?

Many thanks.

Feb 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2501
by: Gomaw Beoyr | last post by:
Two question about the "partial classes" (in the next wersion of ..NET). Question 1 ========== Will partial classes (in the next version of C#) have to be declared "partial" in ALL places. ...
3
4501
by: Lelekács Zoltán | last post by:
Hi, I would like to use a thread together with an object. In the constructor of the object I create the thread and I would like to dispose in the Dispose method of the object, but it is already...
16
2626
by: pawel.pabich | last post by:
Hajo, I would like to have 2 my own partial classes. For example: Default.aspx.cs Default2.aspx.cs and they both will relate to Default.aspx page.
10
2414
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
156
5736
by: Dennis | last post by:
Ok, I'm trying to dispose of every object that I create that has a dispose method based on advice from this newsgroup. However, I'm not sure how to dispose of the following object that was created...
9
5768
by: Fat Elvis | last post by:
I'd like to extend some of my Asp.net pages by using Partial Classes. Example ASP.Net Page: public partial class Admin_Customer : System.Web.UI.Page { protected void Page_Load(object sender,...
4
8003
by: SteveT | last post by:
I have written a control that does some base functionality. I then wrote a control that inherits from it so that I can make several unique versions which behave differently. To do this the...
8
2441
by: Fred* | last post by:
Hello, I'm using Visual C# 2005 Express. if I create a new "application windows" project and run it (F5), it works well. (an empty window is launched..) as soon as I set the build action to...
5
1062
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I noticed one thing that looked a little weird: The Dispose method goes into the generated portion of the partial form. Now, this might not be highly applicable to a Form...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1501
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.