|
-
Apr 14th, 2011, 04:28 PM
#1
Thread Starter
Hyperactive Member
[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
-
Apr 14th, 2011, 04:41 PM
#2
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
That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma
Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney
-
Apr 14th, 2011, 04:45 PM
#3
Re: Constant expression is required
I hate Optional parameters and would also recommend wild bill's method.
-
Apr 14th, 2011, 04:52 PM
#4
Thread Starter
Hyperactive Member
Re: Constant expression is required
That worked perfect. I like this so much better than optional parameters! Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|