473,769 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling a VB.NET-DLL FROM VB6

hi,

I've writte a DLL in VB.NET which is called from VB6.

When I try to call some methods of the DLL in a sub Procedure I get the following error: "Object reference not set to an instance of
an object."

this is my code in VB6 (simplified)

Sub Main
Dim myDLL as new Wrapper.Wrapper

'this works
myDLL.CallMetho d
End Sub

But when i try this, I get an error:

Sub Main

Dim myDLL as new Wrapper.Wrapper

Call callMethodFromD LL
End Sub

Sub callMethodFromD LL(ByRef myDLL as Wrapper.Wrapper )

'here i get the error
myDLL.CallMetho d

End Sub

Has anyone an idea?

br
Peter

Sep 6 '06 #1
4 5327
Peter Piry wrote:
I've writte a DLL in VB.NET which is called from VB6.

When I try to call some methods of the DLL in a sub Procedure I get the
following error: "Object reference not set to an instance of an object."
Do you get this error on /some/ methods, or on *all* of them?
But when i try this, I get an error:

Sub Main

Dim myDLL as new Wrapper.Wrapper

Call callMethodFromD LL

End Sub

Sub callMethodFromD LL(ByRef myDLL as Wrapper.Wrapper )

'here i get the error
What error???
/You've/ seen it - /we/ haven't ...
myDLL.CallMetho d

End Sub
Are you /sure/ that's where the error is?
The above code won't even compile.

callMethodFromD LL requires one argument - a reference to your Wrapper
object. According to the above, you haven't supplied one.

Sub Main
Dim myDLL as new Wrapper.Wrapper
Call callMethodFromD LL( myDLL )
End Sub

HTH,
Phill W.
Sep 6 '06 #2

"Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-kwrote in message news:ed******** **@south.jnrs.j a.net...
Peter Piry wrote:
>I've writte a DLL in VB.NET which is called from VB6.

When I try to call some methods of the DLL in a sub Procedure I get the
following error: "Object reference not set to an instance of an object."

Do you get this error on /some/ methods, or on *all* of them?
>But when i try this, I get an error:

Sub Main

Dim myDLL as new Wrapper.Wrapper

Call callMethodFromD LL

End Sub

Sub callMethodFromD LL(ByRef myDLL as Wrapper.Wrapper )

'here i get the error

What error???
/You've/ seen it - /we/ haven't ...
>myDLL.CallMeth od

End Sub

Are you /sure/ that's where the error is?
The above code won't even compile.

callMethodFromD LL requires one argument - a reference to your Wrapper
object. According to the above, you haven't supplied one.
yes, sorry, i've forgotten to write the Argument. The right line: Call callMethodFromD LL(mydll). i have this line in my code.
>
Sub Main
Dim myDLL as new Wrapper.Wrapper
Call callMethodFromD LL( myDLL )
End Sub

HTH,
Phill W.
Sep 6 '06 #3
I know we're only working with pseudocode here, but is the problem that
you haven't called your constructor?
I've dug out the one time I ever used a COM object in VB6, and the code
there says, basically:

dim namedCOMObject as COMObject
namedCOMOBJECT = new COMObject

If you're calling methods to the COM object directly, they may work
without you having an instance of the object, but if you want to use
information from an instance of the object, I'm fairly certain you have to
spread constructing it over two lines, as above.

I'm only a student though. I might be talking nonsense

KF

On Wed, 06 Sep 2006 15:28:56 +0100, Peter Piry <pe********@ref lex.at
wrote:
>
"Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-kwrote in message
news:ed******** **@south.jnrs.j a.net...
>Peter Piry wrote:
>>I've writte a DLL in VB.NET which is called from VB6.
When I try to call some methods of the DLL in a sub Procedure I get
the following error: "Object reference not set to an instance of an
object."
Do you get this error on /some/ methods, or on *all* of them?
>>But when i try this, I get an error:
Sub Main
Dim myDLL as new Wrapper.Wrapper
Call callMethodFromD LL
End Sub
Sub callMethodFromD LL(ByRef myDLL as Wrapper.Wrapper )
'here i get the error
What error???
/You've/ seen it - /we/ haven't ...
>>myDLL.CallMet hod
End Sub
Are you /sure/ that's where the error is?
The above code won't even compile.
callMethodFromD LL requires one argument - a reference to your Wrapper
object. According to the above, you haven't supplied one.

yes, sorry, i've forgotten to write the Argument. The right line: Call
callMethodFromD LL(mydll). i have this line in my code.
> Sub Main
Dim myDLL as new Wrapper.Wrapper
Call callMethodFromD LL( myDLL )
End Sub
HTH,
Phill W.


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Sep 6 '06 #4
"Kristian Frost" <kf****@gmail.c omwrote in message news:op******** *******@rndskyc omwin.domain...
I know we're only working with pseudocode here, but is the problem that
you haven't called your constructor?
I've dug out the one time I ever used a COM object in VB6, and the code
there says, basically:

dim namedCOMObject as COMObject
namedCOMOBJECT = new COMObject

If you're calling methods to the COM object directly, they may work
without you having an instance of the object, but if you want to use
information from an instance of the object, I'm fairly certain you have to
spread constructing it over two lines, as above.

I'm only a student though. I might be talking nonsense

KF

On Wed, 06 Sep 2006 15:28:56 +0100, Peter Piry <pe********@ref lex.at>
wrote:
>
"Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-kwrote in message
news:ed******** **@south.jnrs.j a.net...
>Peter Piry wrote:
>>I've writte a DLL in VB.NET which is called from VB6.
When I try to call some methods of the DLL in a sub Procedure I get
the following error: "Object reference not set to an instance of an
object."
Do you get this error on /some/ methods, or on *all* of them?
>>But when i try this, I get an error:
Sub Main
Dim myDLL as new Wrapper.Wrapper
Call callMethodFromD LL
End Sub
Sub callMethodFromD LL(ByRef myDLL as Wrapper.Wrapper )
'here i get the error
What error???
/You've/ seen it - /we/ haven't ...
>>myDLL.CallMet hod
End Sub
Are you /sure/ that's where the error is?
The above code won't even compile.
callMethodFromD LL requires one argument - a reference to your Wrapper
object. According to the above, you haven't supplied one.

yes, sorry, i've forgotten to write the Argument. The right line: Call
callMethodFromD LL(mydll). i have this line in my code.
> Sub Main
Dim myDLL as new Wrapper.Wrapper
Call callMethodFromD LL( myDLL )
End Sub
HTH,
Phill W.


Hi,

I've solved the problem. It was a writing protection on the document, which the sub procedure opens.

Mysteriously it works at the first time.

br
Peter
Sep 7 '06 #5

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

Similar topics

0
993
by: Elrond Bishop | last post by:
Hi I am having a problem calling a .Net object and passing an object to it from normal asp. the normal asp keeps seing the object I want to pass as a "string" variant type instead of an object. Is there any way to do this in asp ? Thank You
3
1458
by: Neil Penn | last post by:
I need to be able to call some .NET code from an old VB application. Looking around on MSDN it looks like I should expose the .NET code as a COM object and access the COM object from Visual Basic. Does anyone have any experience of doing this? Is this the best strategy or is there another way to do it? Thanks
1
318
by: Bobby | last post by:
Hello, I'm seeing strange behavior experimenting with calling .NET. If I create a project in .NET 2k3 and select 'interop assembly' it will create the CCW for me, correct? I created a class library with this class in it: Public Class TestCCW Public Sub Stream(ByVal filename As String) MsgBox("filename is '" & filename & "'")
9
4353
by: Eddie J | last post by:
I'm getting an intermittent error when calling a .NET web service from a .NET console application. Both are using v.1.1.4322 of the framework. Any ideas on what could be causing this? It can fail and then a few seconds later can work fine. The exception is: <log4net:event logger="WRDataSyncApp" timestamp="2005-01-11T03:00:49.7336956-05:00" level="ERROR" thread="5808"
1
3154
by: ecydba | last post by:
When attempting to use a web service that has NTFS permissions to the Domain Users group and Anonymous access turned off in IIS on a WinXP machine with the following classic ASP code: Dim oSoap Set oSoap = Server.CreateObject("MSSOAP.SoapClient30") oSoap.ClientProperty("ServerHTTPRequest") = True
1
2635
by: Scott Yen | last post by:
Hi, I'm using the following Axis java client to invoke a .Net web service hosted my localhost. Although the username and password is set on the "call", client gets (401) Access Denied" exception. private static void testTest() { try { String endpoint = "http://localhost/WebService1/Service1.asmx"; String method = "Test";
0
1753
by: =?Utf-8?B?QWRhbUM=?= | last post by:
Hi, I'm wondering if you can help. We have a classic asp application that creates and posts some XML using the SOAP format to a .NET WebService. The WebService and the asp are on the same IIS server , which is IIS6.0. On first calling the WebService the asp page either hangs or returns Active Server Pages error 'ASP 0113' Script timed out /adminw/logon/DeleteUser.asp
4
3872
by: gengyue | last post by:
Hi, I need to call .Net webservice from my JSP page. My application is Struts application. It is deployed on Oracle application server. Here is the whole process. I have a login form. When user hit login button, my Action class will validate the user information and send his information to the other site by calling .Net web service, so the other site can extract these information. So, in my jsp, I am using Javascript and webservice.htc to...
4
4123
by: gengyue | last post by:
Hi, I need to call .Net webservice from my JSP page. My application is Struts application. It is deployed on Oracle application server. Here is the whole process. I have a login form. When user hit login button, my Action class will validate the user information and send his information to the other site by calling .Net web service, so the other site can extract these information. So, in my jsp, I am using Javascript and webservice.htc to...
0
1190
by: gengyue | last post by:
Hi, Refer to my previous post "Calling web serive from JSP", I found an article on msfn2.microsoft.com. "Using the WebService behavior, it is not possible to call a remote method directly on a server that resides in a different domain from the server hosting the Web page. However, Web servers can communicate directly with other Web servers, even if they reside in different domains. Therefore, it is possible to use the Web server that is...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10038
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6662
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2812
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.