Optional parameters in a VB.net function

  • Thread starter Thread starter Do
  • Start date Start date
D

Do

Hi:

What's the syntax for an optional parameter in my function? I've done so
many ASP 3.0 Web Classes that
I haven't experienced the "Optional" parameter.

Eg. Public function adduser(ByVal firstname as String, ByVal Lastname as
String)

End Function

If I want the lastname to be optional, what is the syntax?

Thanks,

Do
 
Public function adduser(ByVal firstname as String, Optional ByVal Lastname
as String = "")

Remember that when you declare a parameter as optional that you must assign
a default value to it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 
Back
Top