473,548 Members | 2,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

An unhandled exception of type 'System.NullRef erenceException ' occurred

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!
Nov 16 '05 #1
3 16914
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!

Nov 16 '05 #2
Hi juli,

You get this error because you only declare a referense to a
Steema.TeeChart .Styles.Series object. This referenced (called ASeries) is
empty until you reference an object with it, so when you call
ASeries.FillSam pleValues() there is nothing in ASeries that can do
anything and the exception is thrown.

Add this line:

ASeries = new Steema.TeeChart .Styles.Series( );

I'm not familiar with the Series Steema namespace so you may need to
change the constructor and how the object is created (some objects cannot
be created by constructor).

On 18 Jan 2005 01:55:29 -0800, juli <ji****@gmail.c om> wrote:
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!


--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3
Hi Juli,
ASeries = new Steema.TeeChart .Styles.Series( ); I'm not familiar with the Series Steema namespace so you may need to
change the constructor and how the object is created (some objects cannotbe created by constructor).


The series object can be created this way but it is a base class and as
such will probably not be very useful to you. You might want to have a
go with simple working example such as this one:

Steema.TeeChart .Styles.Bar bar1 = new
Steema.TeeChart .Styles.Bar(tCh art1.Chart);
bar1.FillSample Values();

there are many more working examples for you to study in the features
demo and tutorials shipped with TeeChart.

Best Regards,
Christopher Ireland
Programmer
http://support.steema.com

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
536
by: Rafael | last post by:
Hi, I hope I can find some help for this problem IDE: Visual Studio.NET 2003 Developer Editio Language: C# Problem: "An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll. Additional information: Object reference not set to an instance of an object. Visual Studio's IDE is not allowing me to...
0
1650
by: Rafiq Ganaie via .NET 247 | last post by:
HI, I am working on a search application in C#.It is a multithreaded application.it simply takes a URL,Downloads the page using WebRequest and WebResponse classes.Unfortunately it is throwing following runtime exception. An unhandled exception of type 'System.NullReferenceException' occurred in system.dll Additional information: Object...
1
1993
by: Merlynx | last post by:
i am getting that error with the Event() method. Don't know whether if i have used the CreateEvent function well as it is the 1st time i used it moreover i am net to C#. If anyone can point me out the error it would be great. TIA public class Class { public struct SECURITY_ATTRIBUTES{
3
2444
by: cristiank | last post by:
hi everybody, I need to clear something out, does anybody have ever encountered such an exception until now : "Un unhandled exception of type System.NullReferenceException occurred in system.windows.forms.dll Additional information: Object reference not set to an instance of an object." I receive this exception when I use HelpProvider and...
2
7792
by: Raed Sawalha | last post by:
i have a windows form(Main) with listview, when click an item in listview i open other window form (Sub) which generate the selected item from parent window in as treeview items when click any item in treeview i display the content item in axWebBrowser, i close the sub form normally when i close the main the following error is generated An...
3
22362
by: GS | last post by:
why am i getting A first chance exception of type 'System.NullReferenceException' occurred in myapp.exe below? and what can i do get rid of it? Private Function getPrefxType() As String If bSkipGetListBOxComboBoxValue Then Return "" Try
2
1982
by: urukundappa | last post by:
Hi this is chandu, can some help me out in this regard? I had created an Active X dll. I had registered it into the folder from where I want it to make it as .Net dll. I had used the command as
1
3367
by: mejames | last post by:
I am using VB.NET 2003, MYSQL database and Crystal Reports. I am able to generate 1 set of reports using the following code: Imports MySql.Data.MySqlClient Imports SeungNiMartialArtsDB.modFunctions Public Class frmRptProgramAttendance Inherits System.Windows.Forms.Form Private m_Conn As String Private m_Program As String Private...
1
3154
by: Pedro Dinis | last post by:
i have this class library that connects to the database(see appconfig below) compiling 0 errors but when its running i amhaving this error An unhandled exception of type 'System.NullReferenceException' occurred in my_deepot_common.dll Object reference not set to an instance of an obj int this line public...
0
7954
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7805
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6039
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5367
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5085
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.