Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 24th, 2004, 03:35 PM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using VB 6.0 DLLs in .Net

I have an existing DLL in VB 6.0 and I want to use it in .NET. I have added the reference to the DLL, but everytime I call a function in the DLL I get the following error message:

Object reference not set to an instance of an object.

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


I'm not really at the point of wanting to rewrite the DLL in .NET, if I can utilize an existing DLL from VB 6.0.


  #2 (permalink)  
Old June 25th, 2004, 03:25 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

And how do you create the instance of the object? Adding a reference is not enough; after that you'll need to create an instance of your object, just as you would do with any other .NET object.

Can you show some code from the ASPX / Code Behind page?

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #3 (permalink)  
Old June 25th, 2004, 07:39 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That's part of my problem. I DIM an instance of the object, but I never created a new instance. Now when I try to do that, I get an Access Denied error.

Dim DocumentationTree As CDocTree2.AHCDocTree
..
..
DocumentationTree = New CDocTree2.AHCDocTree <== BLOWS up
bFileExisted = DocumentationTree.RemoveFile(<parms list>)

  #4 (permalink)  
Old June 25th, 2004, 07:58 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

So, the object can be instantiated, but you get a different error? New-ing your object did the trick?

Could it be a permissions problem with the code inside the DLL?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #5 (permalink)  
Old June 29th, 2004, 07:25 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It ended up being a permissions problem NOT with my DLL, but with a Microsoft DLL (MSVBVM60.DLL). This must be the DLL that is used to 'wrapper' my DLL. I gave my impersonated user rights to this DLL and everything works just fine!



Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing .NET DLLs from Visual C++ 6.0 tschroeder250 Visual C++ 0 March 13th, 2007 12:17 PM
Using DLLs in VB 6 gjc VB How-To 2 September 7th, 2005 03:47 AM
Making DLLs in VB.NET loganscott2000 VB.NET 2002/2003 Basics 2 April 10th, 2005 04:40 PM
Strong name to msinet wrapper dlls vb.net rameshu007 Classic ASP XML 0 July 13th, 2004 06:07 AM
Help with using DLLs in VB vb_programmer Beginning VB 6 2 September 23rd, 2003 05:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.