Results 1 to 5 of 5

Thread: Calling a C# dll with vb6

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    3

    Exclamation Calling a C# dll with vb6

    Hi all!

    I'm really new to vb6 and have some knowledge of C# and would like to create a vb6 program that calls a C# dll but I've found a huge problem which is, I always get a "dll runtime error 453".

    I've been googling for some hours and can't find the solution for this problem...

    please help.

    thanks a lot

    B33bs

    (here's the code sample... it's just an example)

    Private Declare Function func Lib "C:\Documents and Settings\...\dllnewAtt.dll" () As String

    Private Sub Command1_Click()
    Dim nSpeed As String

    nSpeed = func()

    Form1.Text1.Text = nSpeed

    End Sub
    Last edited by b33bs; Nov 10th, 2009 at 05:30 AM.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Calling a C# dll with vb6

    Just out of curiosity, why are you moving back from .NET to VB6?
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    3

    Resolved Re: Calling a C# dll with vb6

    the company where I'm working at, asked me to customize some software that is written in VB6... they'r trying to update everything to C#.Net but they asked me to change a program and I have 1week to make that change... so as I don't have time to re-program 10thousand lines of vb6 code to C# in a week's time, I decided to call newly created C# functions inside the VB6 code.

    Anyway, I solved my problems today too, so all is good!

    bye!

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Calling a C# dll with vb6

    Perhaps posting up your solution so others that search can benifit from it.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    3

    Resolved Re: Calling a C# dll with vb6

    yes... good Idea... It's not that simple, but if you follow the steps that are shown in the following link, then you will be able to call a C# dll in a vb6 program successfully

    http://msdn.microsoft.com/hi-in/libr...02(en-us).aspx

    Private Declare Function func Lib "C:\Documents and Settings\...\DllSuccess.dll" () As String

    Private Sub Command1_Click()

    Set aux_obj = CreateObject("DllSuccess.Class1")
    x = aux_obj.returnstring()
    Form1.Text1.Text = x

    End Sub

    this worked!

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