|
-
Re: VB6 vs VB.NET...Procedure Calling Syntax
Hi Dan,
"Dan Barclay" <Dan@MVPs.org> wrote in message
news:1lg5luggslh0bkir44opsdrr4764lgg7iq@4ax.com...
<snip>
> Sorry, I don't follow your "new rules".
>
> In VB6, if you see a statement without a Call keyword in front of it
> then its argument list needs no parens surrounding it. That is the
> case whether it's a built-in statement or a user Sub.
>
> Sorry, but that seems *real* simple to me.
Well, its already more complicated than it needs to be and you haven't
mentioned the case of when you are assigning a return value to a variable,
which complicates it even further.
> Now, the issue of whether an *individual argument* has parens around
> it is a separate issue applied to each argument. If you want a copy
> of the variable (or expression), you enclose an individual argument in
> parens (aka "byval").
At some point we have a function call like this:
If GetMyObject(myObjectVar) Then
myObjectVar.DoStuff
End If
At a later date we decide that GetMyObject needs to raise an error if
something goes wrong instead of returning False, so...<cut>...<cut>...
GetMyObject (myObjectVar)
myObjectVar.DoStuff
"Object or with variable not set." What the...! Oh yea, I forgot to
remove the parens, silly me.
Regards,
Dan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks