Page 1 of 1

Static hosting routine causes Object Reference error

Posted: Wed Nov 20, 2013 4:26 pm
by 13052810
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!

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;
            ....
      }
...
}
Can you assist?
Thanks!

Re: Static hosting routine causes Object Reference error

Posted: Fri Nov 22, 2013 3:15 pm
by 10050769
Hello triby,

I would be very grateful, If you can send us a simple project where the exception appears, because we try to investigate because error is produced.

Thanks,