473,656 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

partial class (designer created) and Dispose override

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 defined of
the designer created partial class of the object.
What is the nice solution to dispose the thread? Can I modify the overrided
method in the designer created partial class?

lelez
-----------------------------------
http://www.lelez.hu
http://www.csitcset.hu
ICQ: 177465172
Nov 17 '05 #1
3 4508
Lelekács,

You should be able to modify that file. The implementation of Dispose
falls outside of the region for windows forms designer generated code.

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

"Lelekács Zoltán" <le***@freemail .hu> wrote in message
news:en******** ******@TK2MSFTN GP14.phx.gbl...
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 defined of
the designer created partial class of the object.
What is the nice solution to dispose the thread? Can I modify the
overrided method in the designer created partial class?

lelez
-----------------------------------
http://www.lelez.hu
http://www.csitcset.hu
ICQ: 177465172

Nov 17 '05 #2
"Lelekács Zoltán" <le***@freemail .hu> wrote in message
news:en******** ******@TK2MSFTN GP14.phx.gbl...
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 defined of
the designer created partial class of the object.
What is the nice solution to dispose the thread? Can I modify the
overrided method in the designer created partial class?

lelez
-----------------------------------
http://www.lelez.hu
http://www.csitcset.hu
ICQ: 177465172


The thread class doesn't implement IDisposable - what do you want to do to
the thread, halt it?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk
Nov 17 '05 #3
Yes, but the question was about Dispose method generaly.
It's a little bit strange for me to add a language element to C# to separate
the "generated" and the "edited" code, and after it I have to modify the
generated code... Not nice...I think...

For me the "old fashioned way" was nicer when there was no partial word. Now
I have to keep in mind that some code in a separated file...

lelez
-----------------------------------
http://www.lelez.hu
http://www.csitcset.hu
ICQ: 177465172
Nov 17 '05 #4

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

Similar topics

1
1849
by: Sebastian Sylvan | last post by:
Hey. I have two questions. First of all I'm using the Visual C# Express Beta. When you create a windows application it will automatically split the main form into two files using partial classes. In the solution explorer this is seen hierarchially as somthing like - MainForm.cs -> MainForm.Designer.cs
1
3950
by: Dan Kelley | last post by:
I have 2 projects - 1 Winform project that sends Udp messages using the UdpClient class when a button is clicked, and a Console application that listens for these Udp messages. If I try to use the UdpClient class to receive, it never works. The messages are never received (no exceptions). If I use a normal socket configured to listen for Udp messages, it works perfectly. Below is my sample code. It is only test code - I know the...
3
4245
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint of a subclassed DataGridTextBoxColum dos not seem like a practical way to do it. I have subclassed a DataGrid and overridden the OnPaint as such:
7
1729
by: erin.sebastian | last post by:
Hello Everyone, This is my first attempt at coding using an abstract class and i am getting an error i can't figure out. Here is the back ground. I have a project that contains an abstract class, it's namespace is CIG.Intranet.Commons.User and it has 2 methods in it public abstract getPropertiesHash (string userName) and public abstract getPropertiesXml (string userName) adn the class name is called CPUser.cs
4
1319
by: Grigs | last post by:
Hello, I have a fairly simple class that I created and it works great. Basically it remembers a certain amount of strings. When a new one comes in the oldest drops off. The problem is, when I have the test page open in multiple browsers, they are all getting the same data. I don't want this to happen. I have tried different uses of protected, internal, static and such with no luck. Can anyone help me here?
3
3917
by: Rene | last post by:
VS 2005 uses the Partial Class & <form>.Designer.cs for its windows forms generated code. When upgrading from 2003 the project wizard did not break the form, it left it the old way. I would like to split them. Who the heck do you do that? Other than using the IDE and add a new Form, I was not able to insert the partial Form class in the nice hierarchical way the IDE does it. How do you do that? Thanks.
1
3274
by: JamesB | last post by:
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.
3
3184
by: erich | last post by:
In VS2005, creating a new form creates the form class and a partial (frm*.designer.vb) class file and displays the partial class beneath the main form frm*.vb, which is great. However, when extracting the designer code elements from an existing form class into its own partial class, (or creating new ones) the partial class is displayed in the Solution Explorer under the Project name, that is, at the same level as the file from which it...
7
4654
by: tshad | last post by:
I have a problem with a VS 2003 project. This project was designed and works fine in VS 2003. But trying to open the project I get the following error. ************************************************************ The class EmailPoller can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try...
0
8382
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8717
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8600
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7311
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
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 we have to send another system
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.