hsku6482 says:
For
Each
department
As
String
In
departments
Dim
department1
As
String
= department
Dim
X
As
Integer
()
X = (From p
In
dtRate.AsEnumerable()
Where p.Field(Of
String
)(
"Department"
) = department1
Order By p.Field(Of
String
)(
"Period_Shown"
)
Select
Convert.ToInt32(p.Field(Of
String
)(
"Period_Shown"
))).ToArray()
Dim
Y
As
Decimal
()
Y = (From p
In
dtRate.AsEnumerable()
Where p.Field(Of
String
)(
"Department"
) = department1
Order By p.Field(Of
String
)(
"Period_Shown"
)
Select
Convert.ToDecimal(p.Field(Of
String
)(
"Rate_Int"
))).ToArray()
departments.Add(department1)
RateChart.Series.Add(
New
Series(department1))
RateChart.Series(department1).IsValueShownAsLabel =
True
RateChart.Series(department1).BorderWidth = 3
RateChart.Series(department1).ChartType = SeriesChartType.Line
RateChart.Series(department1).Points.DataBindXY(X, Y)
Next
Change with below code.
For Each department As String In departments.ToList()
Dim department1 As String = department
Dim X As Integer()
X = (From p In dtRate.AsEnumerable()
Where p.Field(Of String)("Department") = department1
Order By p.Field(Of String)("Period_Shown")
Select Convert.ToInt32(p.Field(Of String)("Period_Shown"))).ToArray()
Dim Y As Decimal()
Y = (From p In dtRate.AsEnumerable()
Where p.Field(Of String)("Department") = department1
Order By p.Field(Of String)("Period_Shown")
Select Convert.ToDecimal(p.Field(Of String)("Rate_Int"))).ToArray()
departments.Add(department1)
RateChart.Series.Add(New Series(department1))
RateChart.Series(department1).IsValueShownAsLabel = True
RateChart.Series(department1).BorderWidth = 3
RateChart.Series(department1).ChartType = SeriesChartType.Line
RateChart.Series(department1).Points.DataBindXY(X, Y)
Next