Optional Parameter

sub Test(OptionalByVal myParameters(,)AsString =Nothing)

How do I check that the myParameters has had an array passed to it?

I'm looking for something like the following

if myParameters=nothing

[520 byte] By [John1234566] at [2007-12-24]
# 1

Instead of the optional parameter (old crappy vb 6 way), overload the Sub and then you'll know, ie:

Sub Test(Parameters(,) as string)

'Do Something

End Sub

Sub Test()

'Do Something

End Sub

TaDa at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2
Do it like this:

Private Sub Test(Optional ByVal myParameters(,) As String = Nothing)
If myParameters IsNot Nothing Then
Debug.Print("Array size = {0} x {1}", myParameters.GetLength(0), myParameters.GetLength(1))
End If
End Sub

nobugz at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...