Basically when you are dealing with classes you have 2 separate tings to consider. The object allocated on the managed heap (created using the new operator) and the reference that refers to the object. What you have done is declare the reference (ASeries) but you have not created the object it is pointing at using new. Therefore it is taking its default value which is null.
Now you are calling a method via the reference, but the reference doesn't point to an object so you get a NullReferenceEx ception.
Change tghe line where you declare ASeries to
private Steema.TeeChart .Styles.Series ASeries = new Steema.TeeChart .Styles.Series( ); // this assumes it class has a default constructor
Regards
Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog http://www.dotnetconsult.co.uk
Hello!
I keep getting this error:
An unhandled exception of type 'System.NullRef erenceException ' occurred
Additional information: Object reference not set to an instance of an object.
I am declaring with this code(class member):
private Steema.TeeChart .Styles.Series ASeries;
and than trying to initialize it:
this.ASeries.Fi llSampleValues( );
Why do I get this error?
Thanks a lot!