Hmmm ,,,.........
to the OP
This is discussed here manny times and it mostly indeed ends in a nothing
saying thread
http://www.developersdex.com/vb/mess...1121&r=6705983
http://bytes.com/topic/visual-basic-...ommand-dispose
http://www.pcreview.co.uk/forums/thread-3854824-3.php
etc etc etc etc etc etc
http://www.google.nl/#hl=nl&source=h...c54ad77a0995ae
Read a few of them and try some of the examples i showed in these threads
and you will notice that your program in some of my described situations can
run forever
while if you follow the Not call dispose camp in the same situation your
progs will crash or degrade overall system performance .
In case you are wondering ,, yes i am in the call dispose and set to nothing
camp when it actually makes sense to do so , and if you are in doubt just do
it, as it also doesn`t hurt while omitting it wil sure hurt your app.
As i am a so called "Balena" programmer i follow his design patterns ( wich
actually conform to MS standards as he is also the writer of the MS VB core
reference guides ) described in the Core reference guides of Visual Basic
..Net and in these guide there are examples where a object pointer is set
to nothing and it perfectly makes sence to do so , i have posted this
example several times in the group so with the provided links you should
find it :-) .
Regards
Michel Posseth
"Cor Ligthert[MVP]" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> Yes I've a point, don't tell Wabash, it seems just to create a Trolling
> thread, this is not the VB6 newsgroup.
>
> You wrote
> > There are objects that implement IDisposable that calling Dispose is not
>> strictly necessary - such as DataSet. These objects actually end up with
>> Dispose because they inherit from component. You may see advice from
>> some
>> that says to avoid calling dispose on these objects. I personally
>> disagree
>> with this advice for a number of reasons and suggest that you make it a
>> strict
>> rule to always call dispose if an object implments IDisposable.
>
> What you wrote, is the same reason why the OP was setting anything to
> Nothing in VB6, somebody had written that and he took the chance that that
> one was right as the best. Now you tell him that he should change that
> practice to use on everything which implements Idisposable the "often"
> senseless dispose method, which only trashes often code in the same way as
> for ever using nothing in VB6.
>
> Form Closing
> label1.dispose
> Label2.dispose
> Label3.dispose
>
> Why don't you write that he should always count like this.
>
> Result = Cint(X.ToString) += 1 because every value type implements even an
> overloaded ToString method, so in your theory it must be used.
>
> All Forms controls and components implement the dispose method inherited
> from the Component class.
>
> You know likewise me that where calling the dispose is needed, this for
> forms and components is done implicit but since version 2005 hidden for
> most beginners in VB.Net in the designer part.
>
> You know also very well, that I am almost the only one who shows in the
> Microsoft Visual Basic forums samples with "using", so don't accuse me
> from things, which you know that aint true.
>
> You know how some regulars in this newsgroup disagree about this with you,
> while other of those agree, no problem but don't see it as a kind of
> evangelism to newbie's, who have set in past everything to nothing, just
> to take no risk and somebody wrote it.
>
> With every object which implements IDisposable, can be used with Using,
> so calling Dispose has no sense anymore, use the better code for that, it
> trashes at least not the code like I showed above.
>
> So where Dispose is needed it is better to use the Using keyword and if
> you don't know, you can also use that using keyword.
>
> Luckily the newer Classes don't implement IDisposale anymore so much
> anymore as in past.
>
> Your message could have also been without that sentence I quoted, it would
> have been a good and correct message.
>
> Now it seems at least to me more a little bit to kick some regulars here
> to the head.
>
> Cor
>
>
>
> "Tom Shelton" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
>> On 2010-04-05, Cor Ligthert[MVP] <(E-Mail Removed)> wrote:
>>> However, in fact Tom does not call the Dispose method in 90% of the
>>> cases,
>>> because he knows that those are implicitly called.
>>>
>>>
>>
>> Cor... It is true that I do not often call the Dispose method directly -
>> I generally enclose disposable objects in a using block, which guarentees
>> the
>> call to dispose. The point that I was makeing is that I generally code
>> to
>> make sure that the object is disposed when I am done with it. I in fact,
>> pointed this out in my post to the OP - the use of using. I am
>> suggesting
>> that the OP does likewise. Making sure a dispose call is made,
>> implicitly via
>> using, or explicitly amounts to about the same thing in my book.
>>
>> I wonder, did you have some valid point to make?
>>
>> --
>> Tom Shelton
>