Hello,
Thanks for your help. I just created a method like this:
public void MyGraph_121()
{
string CentreAnnee = Filtre_Cbo_Annee.Text;
Chart Graph_121 = new Chart();
ChartArea ChartArea121 = new ChartArea();
Graph_121.ChartAreas.Add(ChartArea121);
Series series121 = new Series
{
IsValueShownAsLabel = true,
ChartArea = "ChartArea1"
};
Graph_121.Series.Add(series121);
}
Then I said at the top of my page like this:
public int i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14;
public string CentreAnnee;
public ChartAreaCollection Graph_121, ChartArea121, series121;
Then once the graph displayed I test with this button:
private void button1_Click(object sender, EventArgs e)
{
ChartArea121.Clear();
series121.Clear();
ChartArea121.Clear();
}
I have as an error message:
System.NullReferenceException :
'Object reference not set to an instance of an object.'
ChartArea121 was null.
How to declare Chart items?
public ChartAreaCollection Graph_121, ChartArea121, series121;
Is it objects, string does not go, int either?
thank you