Results 1 to 12 of 12

Thread: DLL from VB.Net to VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    4

    DLL from VB.Net to VB6

    I'm new to VB.Net and I just want to ask if it is possible to create a DLL program in VB.Net that can be referenced or used in my VB6 project. I tried creating a DLL project and build it but when I tried to upload/referenced the DLL file in my VB6 project, an error occured "Cannot reference the file". I need somebody's help for this.

    Thanks
    JBats

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: DLL from VB.Net to VB6

    If it is possible, then you'd still need to ship the Framework with your program or at least have it installed on the machine you plan to run the VB6 app on. It'd probably be easier to try to write the DLL in VB6.

    May we ask why you want to do this?
    I don't live here any more.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: DLL from VB.Net to VB6

    Use the Regasm.exe tool to create registry entries for your DLL in the registry, so that it can be accessed like a COM Component.

  4. #4
    Addicted Member
    Join Date
    Mar 2005
    Posts
    142

    Re: DLL from VB.Net to VB6

    To elaborate a little more on Mendhak's answer...

    Yes, it is possible. You have to install the .NEt Framework on the target machine and add the assembly to the machine's Global Assembly Cache. Then, you can add a reference to it in your project just like any other DLL.

    This is a useful technique for incrementally migrating an application from VB6 to .NET.

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    4

    Re: DLL from VB.Net to VB6

    I have an installed VB6 and .Net in my machine and tried building the project in .Net and reference it to VB6. The reason I was doing this research is that I have more than one DLL and OCX project created in VB6 and I want this to move/migrate in .Net slowly that is why I'm trying to move it one by one. I make it sure that when I've tried to work one project from VB6 migrating to .Net when building it, it doesn't change its bahavior when reference in VB6.

    My goal in here is to migrate all my projects from VB6 to .Net one at a time. I've tried setting the property of my project in .Net the setting checked the "Register for COM Interop" and it builds a tlb file, when I tried referencing this in my VB6 project, It works ok but it gets hang-up when opening the program.

  6. #6
    Addicted Member
    Join Date
    Mar 2005
    Posts
    142

    Re: DLL from VB.Net to VB6

    If you check this thread, you'll find a link to a good article that explains how to do exactly what you want.

  7. #7
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727

    Re: DLL from VB.Net to VB6

    this explains it perfectly too.
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: DLL from VB.Net to VB6

    Funny that you should bump this thread up after so long, but another question came to me.

    Can a control created in .NET be added to the components toolbar in Visual Basic? As an example, suppose I create a TextBox+Label control in VB.NET.

    I use the Regasm.exe utility on the DLL, and then... what?

  9. #9
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727

    Re: DLL from VB.Net to VB6

    this is why i came across this thread... doing search work before posting my question.

    ...you read my mind... hopefully you have a simulacre of solution too
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  10. #10
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: DLL from VB.Net to VB6

    We've gone the other way with our conversion.... rather than creating our components in .NET ( of which there are a lot of ) we are converting our frame work portion of the app (the main form and a few supporting forms) to .NET, then referencing the VB6 OXC and DLLs from that.... that allows us to migrate our components over time.

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  11. #11
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: DLL from VB.Net to VB6

    Quote Originally Posted by wildcat_2000
    this is why i came across this thread... doing search work before posting my question.

    ...you read my mind... hopefully you have a simulacre of solution too
    Are we working in the same office by any chance?

    I'm trying to figure this out too at this very moment, and I was about to post a thread on this. If I find something I'll let you know. If you find anything, you better tell me too.

  12. #12
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727

    Re: DLL from VB.Net to VB6

    mendak please continue on this post, i am just posting a message for you
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width