Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

method signitures

Status
Not open for further replies.

leangross

IS-IT--Management
Jul 3, 2002
84
PH
hi people,
Is it possible not to assign value to any paramenter/method signatures on a function?

I have some ex. here.
Code:
public function Test ( byval a as string, byval b as string, byval c as string)

dim z,x,y as string

z = a
x = b
z = c


end funcion

Can i use the function test without passing the three parameters like, Test("qqqq",,"CCCC") ?

I don't want want to use "optional" on the signature because i want those parameters as nullable

Is there a way i could do that?

Thanks
 
You probably want to consider overloading here. Do a websearch on overload. But basically, overloading allows you to use the same name for a sub/function and change the parameters. When writing your code, have you seen the built in functions/subs that have the little arrow when you start them? Showing 1 of 2 or 1 of 8 or whatever. These are overloaded.

It would be something like:

Code:
Public Function ReturnTest(ByVal a As String, ByVal b As String, ByVal c As String) as String

return a & ", " & b & ", " & c

End Function

Public Function ReturnTest() as String

Return ReturnTest(String.Empty, "f", String.Empty

End Function

This allows you to nullify the values you want and even do something completely different if the values are null. That being said, unless I am mistaken, you can always set your parameters as optional and allow them to be null, or String.Empty in the case of string values. Just a thought.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
if mstrmage1768 didnt answer you question, why can you not do this:

Code:
    Sub a(Optional ByVal ava As String = Nothing)

    End Sub

-The answer to your problem may not be the answer to your question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top