Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Argument Count

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,50458
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Argument Count
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Argument Count - 8/7/2007 7:51:29 AM   
  HanSolo


Posts: 16
Score: 0
Joined: 4/3/2007
Status: offline
Is it possible to count the number of arguments passed in VB Script function or sub?






_____________________________

Han
 
 
Post #: 1
 
 RE: Argument Count - 8/7/2007 7:53:20 AM   
  mangusridhar

 

Posts: 5
Score: 0
Joined: 8/7/2007
Status: offline
you can pass the arguments as an array and get the Ubound of the array. you should get the number of arguments passed to the function or sub.

(in reply to HanSolo)
 
 
Post #: 2
 
 RE: Argument Count - 8/7/2007 8:01:38 AM   
  ehvbs

 

Posts: 2196
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi HanSolo,

No; the parameters to a VBScript Sub or Function are determined
by its declaration - no ParamArray as in VB(A).

You may pass an array/a dictionary  to a Sub or Function and treat this as a
kind of do it yourself variable argument list:

   doIt Array( "1", "a" )
   doIt Array()
   doIt Array( "whatever", 2, 3 , 4 )

Sub doIt( aParms )
   ...
   Select UBound( aParms )
       Case -1
            ....
        Case 2
            ....
        Case 3
            ....
        Case Else
            ....
   End Select
  ...
End Sub

Good luck!

ehvbs

(in reply to HanSolo)
 
 
Post #: 3
 
 RE: Argument Count - 8/7/2007 8:09:46 AM   
  HanSolo


Posts: 16
Score: 0
Joined: 4/3/2007
Status: offline
Thanks guys for the info Ill give it a try with arrays...thanks again

(in reply to HanSolo)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Argument Count Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts