Static hosting routine causes Object Reference error
Posted: Wed Nov 20, 2013 4:26 pm
Hi!
If i set a routine (that resides in a form) to static, tChart.whatever generates an error.
'An object reference is required for the non-static field, method or property 'PostJobPlot.Form1.tChart1'.
Frankly, I have no clue how to resolve this. I have searched this site as well as many, many other sites, and cannot come up with a solution.
I believe its a matter of configuration and is probably not difficult, but nonetheless, I'm lost!
Can you assist?
Thanks!
If i set a routine (that resides in a form) to static, tChart.whatever generates an error.
'An object reference is required for the non-static field, method or property 'PostJobPlot.Form1.tChart1'.
Frankly, I have no clue how to resolve this. I have searched this site as well as many, many other sites, and cannot come up with a solution.
I believe its a matter of configuration and is probably not difficult, but nonetheless, I'm lost!
Code: Select all
namespace PostJobPlot
{
public partial class Form1 : Form
{.....
public static void LoadActualArrayItem(int ItemIndex)
{
int aa = 0;
int bb = 0;
double cc = 0;
double dd = 0;
Cursor.Current = Cursors.WaitCursor;
aa = ItemIndex;
tChart1.Series[ItemIndex].Active = true;
tChart1.Axes.Left.AutomaticMaximum = false;
....
}
...
}
Thanks!