optianal argument

  • Thread starter Thread starter Cc
  • Start date Start date
public sub mySub(Optional myVar as Datatype = [defaultvalue])

where Datatype is the color type and default value is, well the default
value...
 
CJ Taylor said:
public sub mySub(Optional myVar as Datatype = [defaultvalue])

where Datatype is the color type and default value is, well the
default value...

....but the default value must be a constant expression, so it is better to
add an overloaded version like

public sub mySub()
mySub(Color.white)
end sub

;-)
 
Hello,

Cc said:
how to declare optinal argument if datatype are color

Optional parameters must not be structures. Create multiple overloads:

\\\
Public Overloads Sub Bla()
Bla(Color.Red)
End Sub

Public Overloads Sub Bla(ByVal Foo As Color)
 
Hello,

CJ Taylor said:
public sub mySub(Optional myVar as Datatype = [defaultvalue])

where Datatype is the color type and default value is, well
the default value...

Optional parameters must not be structure types.
 
Back
Top