[RESOLVED] Constant expression is required
Hi All,
I'm trying to make following subroutine work. The problem is this part of the statement.
Code:
Optional ByVal _CurveColor As System.Drawing.Color = Color.Blue
I've tried everything and can't seem to come up with a constant to use here. Any ideas?
Code:
Public Sub New(Optional ByVal _CurveName As String = "Curve", Optional ByVal _CurveColor As System.Drawing.Color = Color.Blue, Optional ByVal _UseY22 As Boolean = False)
CurveName = _CurveName
CurveColor = _CurveColor
useY2 = _UseY22
End Sub
Re: Constant expression is required
Overload your method:
Code:
Public Sub New()
'Defaults
'_CurveName = "Curve"
'_CurveColor = Blue
'_UseY22 = False
Me.New("Curve", Color.Blue, False)
End Sub
Public Sub New(ByVal _CurveName As String, ByVal _CurveColor As System.Drawing.Color, ByVal _UseY22 As Boolean)
CurveName = _CurveName
CurveColor = _CurveColor
useY2 = _UseY22
End Sub
Re: Constant expression is required
I hate Optional parameters and would also recommend wild bill's method.
Re: Constant expression is required
That worked perfect. I like this so much better than optional parameters! Thanks