473,654 Members | 3,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dispose in Forms (VS 2005)

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 (because you should be
putting resource control code in another class etc), but what if, for
whatever reason, you needed to put some code into the Dispose method?

Any suggestion about it ?

Thanks in advance, greetings.
--
http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.net
http://www.setbb.com/putainformatica...opic.php?p=843
www.trabajobasura.com/solusoft

Jul 22 '08 #1
5 1072
Maybe you can move the method from *.Designer.cs to your *.cs...

L

"Alhambra Eidos Kiquenet" <Al************ *******@discuss ions.microsoft. com>
wrote in message news:E1******** *************** ***********@mic rosoft.com...
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 (because you should be
putting resource control code in another class etc), but what if, for
whatever reason, you needed to put some code into the Dispose method?

Any suggestion about it ?

Thanks in advance, greetings.
--
http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.net
http://www.setbb.com/putainformatica...opic.php?p=843
www.trabajobasura.com/solusoft
Jul 22 '08 #2
Thanks mister,

is the unique solution about it ?

greetings
Jul 22 '08 #3
Hello,

I can't personally think of another...

What code are you putting in the dispose method anyhow?

L

"Alhambra Eidos Kiquenet" <Al************ *******@discuss ions.microsoft. com>
wrote in message news:34******** *************** ***********@mic rosoft.com...
Thanks mister,

is the unique solution about it ?

greetings
Jul 22 '08 #4
You could subscribe to Dispose event or add a custom component (class that
implements IComponent) to the form and it will be notified when form is
being disposed.

"Alhambra Eidos Kiquenet" <Al************ *******@discuss ions.microsoft. com>
wrote in message news:E1******** *************** ***********@mic rosoft.com...
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 (because you should be
putting resource control code in another class etc), but what if, for
whatever reason, you needed to put some code into the Dispose method?

Any suggestion about it ?

Thanks in advance, greetings.
--
http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.net
http://www.setbb.com/putainformatica...opic.php?p=843
www.trabajobasura.com/solusoft

Jul 22 '08 #5
JS
I agree, Dispose should not be in the *.designer.cs code. However,
it's only touched by VS200* when you create the form. AFAIK you can
freely edit code inside Dispose and the designer won't have a problem
or delete your code.
Jul 23 '08 #6

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

Similar topics

4
4515
by: Adriano Coser | last post by:
I'm getting the following error: error C3767: PictureSource - candidate function(s) not accessible when accessing a public member function of a managed class, either from managed or unmanaged code. The class is an owner draw control implemented into a Control Library. The access is on a DLLs that support CLR with old syntax. The code compiled OK on Beta-1.
3
3203
by: Lance | last post by:
I've noticed that controls that are contained in MDI child forms fail to raise MouseLeave events if the MDI child form's MdiParent property is set to Nothing (after it was set to an existing MDI container form) or if the MDI child form's Visible property is set to False (after the MDI child form was shown). This is an enormous problem for my app because I must show different MDI child forms based on the state of my application and many of the...
156
5824
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 inside a method call. dim myvar as new object1 object1.dosomethingmethod(new object2) Note that object 2 has a dispose method but how do I dispose of it unless I do the following:
0
1098
by: **Developer** | last post by:
Would someone pass this on to MS and/or check to see it the problem persists in 2005? I don't have 2005 and do not know how to pass it on. Nor do I have the time to spend learning how unless it really easy. However, I spent much time on this and would like to see what I've learned put to use.
34
4855
by: Bob | last post by:
Hi, The compiler gives Warning 96 Variable 'cmdSource' is used before it has been assigned a value. A null reference exception could result at runtime. Dim cmdSource as SQlClient.SQLDataReader Try Set up the database read and do it. Catch ex as system.exception exception stuff here Finally
9
1699
by: Geoff Callaghan | last post by:
I have several functions that require doing a New on a local object. If the object is local to a sub or function, do I need to dispose of it, or will it just go away like any other local variable? Geoff Callaghan
13
1516
by: Grafix | last post by:
All - As we all know, Dispose method is reserved in C++ 8 and the expected syntax is to use ~MyClass(). In 1.1, we used to have following structure for Dispose class MyClass : IDisposable { public void Dispose() { Dispose(true); GC.Supressxxx(this); } ~Dispose() { Dispose(false); } // Finalizer
1
1015
by: Dave Harry | last post by:
I've had trouble with VB 2003 not doing things quite right, help won't compile, etc, things are being a general pain the the bum. I've downloaded the VB Express 2005 and trying my code there before buying VB 2005 standard. Should the forms' code, that was upgraded from VB6 to 2003, still work properly in 2005? The program function was expanded so much after upgrading to 2003 that it would be rather a nightmare to do it again from 6 ->...
8
3572
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a picture box, lots of text boxes (for input).. you get the idea. All of a sudden everything on the form has disappeared, it looks like a blank, newly created form. I can still get to the properties of every item on the form using the drop-down box in...
19
4632
by: rbrowning1958 | last post by:
Hello, I am confused by dispose etc. and hope someone can set me right. 1. The Dispose(Bool) the IDE generates for a form has nothing to do with IDisposable, right? 2. So when is this called? When a form is closed? If this is caused automatically when a form is closed how can I then access things on a modal from after ShowDialog() returns? Or is it only for modeless forms?
1
8475
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8591
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
7304
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
5621
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
4149
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...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2709
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
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1592
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.