Click to See Complete Forum and Search --> : [RESOLVED] Create a method with optional parameters


carlos.ao
03-09-2006, 02:48 AM
Hello,
Is there any way to create a method with optional parameters in vbscript?
For example:

'Method:
Sub method1(param1, param2, param3)
'script
End Sub

'Calling the method:
'only passing one parameter, only param1 is necessary
method1 param1
'passing three parameters, because they are needed
method1 param1, param2, param3

thanks

JayM
03-09-2006, 11:26 AM
Unfortunately in ASP optional arguments are not supported. However, you can declare the arguments as null.

You can also use a JavaScript alternative.

This answers your question (http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=42).

Cheers