18
Reply

cannot implicitly convert type string[] to decimal[]

john kanyora

john kanyora

Dec 18 2017 3:16 AM
285
Hi, am trying to get my values in a bar chart be in the fromat of currency.am using the code below but am now getting an error that " cannot implicitly convert type string[] to decimal[].
the error is in the line of code i have highlighted.please kindly help.
string[] x = new string[dt.Rows.Count];

string[] y = new string[dt.Rows.Count];

for (int i = 0; i<dt.Rows.Count; i++)
{
x[i] = dt.Rows[i][0].ToString();
y[i] = string.Format("{0:##,##0.00}", dt.Rows[i][1].ToString());
}

BarChart1.Series.Add(new AjaxControlToolkit.BarChartSeries { Data = y});

BarChart1.CategoriesAxis = string.Join(",", x);

 

Answers (18)