469,602 Members | 1,727 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

System.NullReferenceException: Object reference not set to an instance of an object

Hi,

I'm trying to call a function written in a dll file, from ASP.NET 1.1 web application.

Part of code in global.asax:

<%@ Import namespace="WPPSYSTEMDLLLib" %>

Sub Application_OnStart()

Dim Value As Object

Application("WPPSystem") = new WPPSystem() <-- the name of the class

Res = Application("WppSystem").INIStrGet("WPP", "StartPage", "", Value, "c:\wpp.ini", 0)

I get the following error:

System.NullReferenceException: Object reference not set to an instance of an object

Application("WPPSystem") is not null. It does get the instance of object.

Any idea whats wrong?

Thanks a lot,

zvikorn
Jul 28 '06 #1
5 9998
Enyi
38
It could possibly be an object inside your referenced dll that hasn't been initialised. Maybe there is another method which you need to call first to initialise an object, in the dll before the method you call on the line where the error occurs in your code.
Jul 30 '06 #2
dotnet
22
you have not created a object of your WPPSystem class.

you can do it as

Dim objWPPSystem as WPPSystem






Regards
Nitin Mittal
http://www.dotnetdonkey.com
Jul 30 '06 #3
It could possibly be an object inside your referenced dll that hasn't been initialised. Maybe there is another method which you need to call first to initialise an object, in the dll before the method you call on the line where the error occurs in your code.

10x for your reply.
There is no other method to call before.
What I'm thinking is, one of the parameters has to be called by reference. in the dll its defined: byRef myStr.
How can I write it in the calling method? I cant just pass the parameter itself.
Jul 30 '06 #4
Enyi
38
Did you try what dotnet said?

Yes you can just pass the parameter itself. I'm not 100% sure about the difference between ByVal and ByRef. Try Googling for them :)
Jul 31 '06 #5
aotter
1
did you guys figure this out? I'm having exactely the same problem calling an old C++ dll from C#, it's also a function that passes a parameter by reference. I can call all the other functions in the dll that don't pass any values by reference just fine!!!
Aug 14 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Terrence | last post: by
5 posts views Thread by Vitling | last post: by
1 post views Thread by msnews.microsoft.com | last post: by
4 posts views Thread by Terry Mulvany | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.