I have read that passing Optional Arguments now need to contain a default value.
Can the default value be Empty, Null etc?
Code:Sub foo(Optional ByVal y As Integer = Null)
Printable View
I have read that passing Optional Arguments now need to contain a default value.
Can the default value be Empty, Null etc?
Code:Sub foo(Optional ByVal y As Integer = Null)
Yes, you can still use Optional Parameters, but you have to specify the default value. This is required because IsMissing function is no longer supported.
You can also achieve this by using function overload. I personally like function overload better then optional parameters.VB Code:
Public Function MyFunct(Optional MyParam As Integer = -1) As Boolean
Actually, the only reason Optional Parameters existed in previous versions of VB is because there was no function overload feature.