Home All Groups Group Topic Archive Search About
Author
21 Nov 2006 2:42 PM
Jay
Is there a difference between using Call ProcName vs just using ProcName?
If not, is it considered proper to use Call when calling another proc?
Thanks.

Author
21 Nov 2006 2:49 PM
Herfried K. Wagner [MVP]
"Jay" <some***@somewhere.com> schrieb:
> Is there a difference between using Call ProcName vs just using ProcName?

No.

> If not, is it considered proper to use Call when calling another proc?

In VB6 I always used 'Call', but in VB I omit it except in one scenario
where it is mandatory:

\\\
Call (New MainForm()).Show()
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
21 Nov 2006 3:03 PM
Robinson
> where it is mandatory:
>
> \\\
> Call (New MainForm()).Show()
> ///
>

Why is it mandatory here?  What happens to the instance when the call drops
out of scope? (just curious ;).
Author
21 Nov 2006 3:20 PM
Herfried K. Wagner [MVP]
"Robinson" <toomuchspamhaspassed@myinboxtoomuchtoooften.com> schrieb:
>> where it is mandatory:
>>
>> \\\
>> Call (New MainForm()).Show()
>> ///
>>
>
> Why is it mandatory here?  What happens to the instance when the call
> drops out of scope? (just curious ;).

It stays alive because somewhere in the Windows Forms library a reference to
the form prevents the form from being released.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
22 Nov 2006 3:20 PM
Phill W.
Jay wrote:
> Is there a difference between using Call ProcName vs just using
> ProcName? 
(Double-check newsgroup ... dotnet ... OK)

No difference at all.

> is it considered proper to use Call when calling another proc?

I'd say "Ditch it"; it's just eye candy now.

If you're still looking after VB "Proper" code, though, I would strongly
recommend using Call there; it gets your code into better shape for when
you need to migrate it to the newer "versions" of Visual Basic.

HTH,
    Phill  W.