PeterWJohnson
New member
- Joined
- Jul 21, 2014
- Messages
- 3
- Programming Experience
- 10+
Hi Guys,
I am trying to display a stripline on a chart that shows a particular date.
I have tried a number of different ways of coding.
' This works....
' But this doesn't....
How can I use the variables StartYear, StartMonth and StartDay to give me a StartDate?
The piece of code that doesn't work displays nothing on the chart. I need the code that does work to display the line on the chart at the date passed by the variables.
Any ideas?
Cheers
Peter
I am trying to display a stripline on a chart that shows a particular date.
I have tried a number of different ways of coding.
' This works....
Dim StartYear As Integer = 2014 Dim StartMonth As Integer = 4 Dim StartDay As Integer = 25 Dim StartDate As Date = New Date(StartYear, StartMonth, StartDay) Dim sl1 As New StripLine sl1.Interval = 0 sl1.IntervalOffset = (StartDate.ToOADate) - 0.25 sl1.IntervalOffsetType = DateTimeIntervalType.Days sl1.StripWidth = StartDate.AddDays(0.5).ToOADate - StartDate.ToOADate sl1.StripWidthType = DateTimeIntervalType.Days sl1.BackColor = Color.Red sl1.Text = StartDay & "/" & StartMonth & "/" & StartYear Chart.ChartAreas(0).AxisX.StripLines.Add(sl1)
' But this doesn't....
Dim StartYear As Integer = CType(cboPlannedStartYear.Text, Integer) Dim StartMonth As Integer = CType(cboPlannedStartMonth.Text, Integer) Dim StartDay As Integer = CType(cboPlannedStartDay.Text, Integer) Dim StartDate As Date = New Date(StartYear, StartMonth, StartDay) Dim sl1 As New StripLine sl1.Interval = 0 sl1.IntervalOffset = (StartDate.ToOADate) - 0.25 sl1.IntervalOffsetType = DateTimeIntervalType.Days sl1.StripWidth = StartDate.AddDays(0.5).ToOADate - StartDate.ToOADate sl1.StripWidthType = DateTimeIntervalType.Days sl1.BackColor = Color.Red sl1.Text = StartDay & "/" & StartMonth & "/" & StartYear Chart.ChartAreas(0).AxisX.StripLines.Add(sl1)
How can I use the variables StartYear, StartMonth and StartDay to give me a StartDate?
The piece of code that doesn't work displays nothing on the chart. I need the code that does work to display the line on the chart at the date passed by the variables.
Any ideas?
Cheers
Peter
Last edited by a moderator: