 |
| Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET). |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 10th, 2006, 08:32 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2006
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Sub Parentheses
Hello there!
I've a Question, pls answer me
when I call any Visual basic's sub(Procedure) by passing one parameter without parentheses it runs successfully but without parentheses not why is it......
And if I pass more than one parameters then it does not demand for parentheses
Thanks for any reply....
Deepak..
__________________
DPK..
|
|

March 10th, 2006, 09:34 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Deepak!!
Sub don't accept parentheses when we pass parameters.
Parentheses is used with function while passing parameters.
Hope this will help you
Cheers :)
vinod
|
|

March 10th, 2006, 09:57 AM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You may use Call Keyword.
With Call:
Call MySub (parameter1, parameter2, ..., parameterN)
without Call:
MySub parameter1, parameter2, ..., parameterN
|
|

March 11th, 2006, 12:45 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2006
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Quote:
quote:Originally posted by vinod_yadav1919
Hi Deepak!!
Sub don't accept parentheses when we pass parameters.
Parentheses is used with function while passing parameters.
Hope this will help you
Cheers :)
vinod
Hi Vinod
Thanks for your reply but as you said that sub don't accept parentheses, this is not completely true because if you use the 'CALL' keyword with sub, it will take parentheses.....
Good Day
|
Deepak..
|
|

March 11th, 2006, 12:54 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2006
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Quote:
quote:Originally posted by peko
You may use Call Keyword.
With Call:
Call MySub (parameter1, parameter2, ..., parameterN)
without Call:
MySub parameter1, parameter2, ..., parameterN
|
Hi Peko!
Thanks your Reply...
Can you tell me what is the difference between calling Function or Procedure with call keyword or without call keyword.
Thanks ....
Deepak..
|
|

March 11th, 2006, 06:44 AM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi!
Assumend from MSDN:
You are not required to use the Call keyword when calling a procedure. However, if you use the Call keyword to call a procedure that requires arguments, argumentlist must be enclosed in parentheses. If you omit the Call keyword, you also must omit the parentheses around argumentlist. If you use either Call syntax to call any intrinsic or user-defined function, the function's return value is discarded.
To pass a whole array to a procedure, use the array name followed by empty parentheses.
Peko
|
|

March 11th, 2006, 07:22 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
|
|
HI Peko!!
That's great.
Cheers :)
vinod
|
|
 |