Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Got an error while Saving a record!!

Iam a Visual Basic Developer. I am improvising my skills by leearning VB.Net. Iam a Beginner to .Net.

I Created a Web service and a client application as well. After debugging, i ran the application. The loading of the database is taking place correctly, but while iam trying to save new records, its giving me the following error:
"An unhandled exception has occurred in your application..................
Object Reference not set to an instance of an object."

I couldnt figure out what to do. I followed someone's solution and added some code in the configuration file so the the exceptions will be handled by the Debugger. But that gave me this following error:
"JITDebugging failed with the following error:0x800405ae"

I dont know what to do. Can someone please help me out with this.

Nitu singh
Tuesday, October 26, 2004

I'm relatively new to the VB .NET stuff as well, but it sounds like you referenced a class, not an instance of a class.

i.e.
Dim dsCompany as Dataset
dim dsCmpy as New dsCompany --probably the part left out

Later you refer to dsCompany

That error code seems to come up for a range of things...

Hope that helped.

Anomalous
Tuesday, October 26, 2004

Yeah, your code is trying to use a null pointer, which is a way of saying an uninitialised class instance.

As Anomalous says, look for code like:

Dim myClass as ClassType

Instead of:

Dim myClass as new ClassType

In general, if you are creating a new object (i.e. class instance), then you should use the "new" modifier, so the compiler knows to set aside space for the object, and initialise it, via it's constructor.

On the other hand, if you are just getting an object from somewhere else, for example as a function parameter, or copying another object, then you don't use the "new" modifier, as you just want the compiler to reserve the space. There is no need to initialise the object (via the constructor), as we are just going to be copying another object anyway.

[Forgive my pseudo-VB syntax, it's been years as everything is C# for me now]

Nemesis [µISV]
Wednesday, October 27, 2004

Thank you very much. The proble was that I infact forgot to create and instance of the object, rather i used the class directly. Thank you very much for your help.

Nitu singh
Wednesday, October 27, 2004

*  Recent Topics

*  Fog Creek Home