Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / March 2004

Tip: Looking for answers? Try searching our database.

A Way to use .Net dll in VB6

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eric Levy - 25 Mar 2004 18:10 GMT
I am having problems with MS getting rid of MS J++... I have a large
application that uses MS J++ code as a back-end data retrieval mechanism
into a VB application.  I am not ready to port my VB app to .Net, but
appearently I have to port my MS J++ code to J#.Net because of the
discontinued support of Java.  Is there a way to create a DLL from J#.Net
that my VB 6.0 App can use?  Does anyone else have any other suggestions.  I
would prefer to keep the code in Java, but it doesn't look like that is
possible unless there is a way to create a DLL that VB can use like VJ++
could create.
Thanks,
Eric
Please e-mail back at:
elevy_NoSpam@weathermetrics.com
Please remove the "_NoSpam" from the e-mail.
David Browne - 25 Mar 2004 19:09 GMT
> I am having problems with MS getting rid of MS J++... I have a large
> application that uses MS J++ code as a back-end data retrieval mechanism
[quoted text clipped - 6 lines]
> could create.
> Thanks,

Sure you can.  Just port your J++ project to J#.  The result will be an
assembly which can be configured for COM interop.  From there it can be run
from VB6.

Look up COM interop in the documentation to learn how to use .NET assemblies
which can be used from COM.

David
Eric Levy - 26 Mar 2004 16:19 GMT
I did this and I had to add _dispatch to my classes that I was calling in
VB6.0 (I'm not sure why I need to add _dispatch, but that is the way it was
listed in the Object Browser.)
I'm now running into the problem:
"Function or interface marked as restricted, or the function uses an
Automation type not supported in Visual Basic"
on the following line of code, which worked fine with my VB compiled code.

rainfall = dataProcessor.getRainfallDouble(ru)

Previous in the code this was called:
ru = dataProcessor.hexAddrToRegionUnit(adoElementsRS!WxStation)

The declaration for getRainfallDouble looks like:
public double getRainfallDouble(int[] rgnunit)

The declaration for the hexAddrToRegionUnits looks like:
public int[] hexAddrToRegionUnit(String HexAddr)

I tried passing ru as a variant and an integer array and neither way will
the code compile.  It worked fine in VJ++, what's the difference between the
using the Com Interop and VJ++?
Thanks,
Eric

> > I am having problems with MS getting rid of MS J++... I have a large
> > application that uses MS J++ code as a back-end data retrieval mechanism
[quoted text clipped - 16 lines]
>
> David
David Browne - 26 Mar 2004 17:30 GMT
> I did this and I had to add _dispatch to my classes that I was calling in
> VB6.0 (I'm not sure why I need to add _dispatch, but that is the way it was
[quoted text clipped - 20 lines]
> Thanks,
> Eric

VJ++ was as COM language J# has a completely different type system.  COM
interop is a large and tricky subject, plus you are working across 2
different languages.  So here's a suggestion to bypass a lot of the
marshalling and signature headache you're facing.

Write a wrapper DLL in VB6 which supplies your interface.  Just stub out the
implementations.  Then run that VB6 project throught the DOT.NET upgrade
wizard.  The wizard should handle all of your marshaling troubles.  Then in
your VB.NET library you can access your J# library.

David

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.