TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vikas Ahlawat
NA
564
817.9k
where did i mistake?
Feb 28 2010 1:15 PM
I m using telerik radchart control in my window programm. below the code for populate chart. when i m using arrary then it give error , but if i simply declare chartseries then it working.
if i m using chartseries array which is show in rad color , then it gives error, and if i using green code then it working properly both code are shame only array difference.
error occuring on
a[0].AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][0]));
error is: - nullreferenceexception was unhandled ,Object reference not set to an instance of an object.
SqlCommand cmd1 = new SqlCommand("select Paper1,Paper2,Paper3,Paper4,Paper5 from Student_Exams_Marks_Detail where S_ID='" + comboBox3.Text + "'and Section='" + comboBox2.Text + "' and Class='" + comboBox1.Text + "' ", con);
SqlDataAdapter da = new SqlDataAdapter(cmd1);
SqlDataAdapter da1 = new SqlDataAdapter(cmd3);
da.Fill(ds, "Marks");
da1.Fill(ds, "SubjectNames");
radChart1.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Years";
//radChart1.DataSource = ds.Tables["v"];
radChart3.DataSource = ds.Tables["Marks"];
radChart4.DataSource = ds.Tables["Marks"];
//radChart1.Skin = "LightBlue";
radChart3.DataBind();
radChart4.DataBind();
//ChartSeries[] a;
//a = new ChartSeries[5];
//a[0].AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][0]));
//a[1].AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][1]));
//a[2].AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][2]));
//a[3].AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][3]));
//a[4].AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][4]));
//a[0].Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][3]);
//a[1].Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][4]);
//a[2].Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][5]);
//a[3].Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][6]);
//a[4].Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][7]);
//radChart1.Clear();
//radChart1.Series.Add(a[0]);
//radChart1.Series.Add(a[1]);
//radChart1.Series.Add(a[2]);
//radChart1.Series.Add(a[3]);
//radChart1.Series.Add(a[4]);
ChartSeries s1 = new ChartSeries();
ChartSeries s2 = new ChartSeries();
ChartSeries s3 = new ChartSeries();
ChartSeries s4 = new ChartSeries();
ChartSeries s5 = new ChartSeries();
s1.AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][0]));
s2.AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][1]));
s3.AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][2]));
s4.AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][3]));
s5.AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][4]));
s1.Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][3]);
s2.Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][4]);
s3.Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][5]);
s4.Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][6]);
s5.Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][7]);
radChart1.Clear();
radChart1.Series.Add(s1);
radChart1.Series.Add(s2);
radChart1.Series.Add(s3);
radChart1.Series.Add(s4);
radChart1.Series.Add(s5);
radChart1.PlotArea.XAxis.AxisLabel.TextBlock.Text = "vk";
radChart1.DataBind();
please help me what is wrong in it.
Reply
Answers (
3
)
Custom Dictionary Sort C#
I want to get list from .resx file