Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. VC++.net & VB.Net Compatibility

VC++.net & VB.Net Compatibility

Scheduled Pinned Locked Moved .NET (Core and Framework)
questioncsharpc++
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    ksandy45
    wrote on last edited by
    #1

    Hello , can we call VC++.net function in VB.net or vice Verse. If yes then what is the methodology to do so? Thanks for the support

    Kind Regards Sandy

    K 1 Reply Last reply
    0
    • K ksandy45

      Hello , can we call VC++.net function in VB.net or vice Verse. If yes then what is the methodology to do so? Thanks for the support

      Kind Regards Sandy

      K Offline
      K Offline
      Kevin McFarlane
      wrote on last edited by
      #2

      Create a class library project in one or the other. Then in the client app. add a reference to it and an import or using statement.

      Kevin

      K 1 Reply Last reply
      0
      • K Kevin McFarlane

        Create a class library project in one or the other. Then in the client app. add a reference to it and an import or using statement.

        Kevin

        K Offline
        K Offline
        ksandy45
        wrote on last edited by
        #3

        Hi Kevin, Thank you very much, i think you are right, i can do that. But what if there is a project with a form in VB.net. can i make this form or module as a part of my VC++. net file. To be very clear, i have one module with a form in VB.net. i want this form to open when i click a button in VC++.net MDI dialog box. Is it possible? i guess not?? What about porting that form into my VC++. net MDI? Kindly help me, i hope my problem is stated well. if not kindly ask me to be clear. Thank you.

        Kind Regards Sandy

        A 1 Reply Last reply
        0
        • K ksandy45

          Hi Kevin, Thank you very much, i think you are right, i can do that. But what if there is a project with a form in VB.net. can i make this form or module as a part of my VC++. net file. To be very clear, i have one module with a form in VB.net. i want this form to open when i click a button in VC++.net MDI dialog box. Is it possible? i guess not?? What about porting that form into my VC++. net MDI? Kindly help me, i hope my problem is stated well. if not kindly ask me to be clear. Thank you.

          Kind Regards Sandy

          A Offline
          A Offline
          AIMrus
          wrote on last edited by
          #4

          Hy Sandy, I faced a similar problem, and find the solution. In my case, I created a C++ .NET Class Library with Form class and ported to C+++ Builder as an MDI Child. I absolutly sure, your problem can be solved too. Some suggestion: -Create Class library with Form class -Write a public Interface with CreateForm() method -Write a public class which expose the Interface; in the CreateForm() method create a Form and call the form Show() method; -Create a Type Library and register it with regasm.exe -Add the assembly to the GAC with gacutil.exe In the Other DEV Environment: -import type library -create an instance of the public class -Call the CreateForm() method and you'll see a form :) To resolve the MDI child problem -pass the parent handle to the childe + Call SetParent() WinAPI fuction -set the child window style to MDIShilde with the SetWindowLong() WinAPI fuction This guideline is bullshit, I know... You probably dont understand, what I mean... but I tryed. :) I guess, there is a simpler solution to your problem, because you stay in the .NET Framework... If I have some free time, I'll write a tutorial to explain everything... Till then, don't give up... -- modified at 5:13 Friday 27th October, 2006 Useful resources: MSDN .Net Interop articles Exposing .NET Components to COM By Nick Parker. http://www.codeproject.com/dotnet/nettocom.asp Understanding Classic COM Interoperability With .NET Applications By Aravind C. http://www.codeproject.com/dotnet/cominterop.asp .NET - COM Interoperability By KRISHNA PRASAD.N. http://www.codeproject.com/dotnet/COM\_DOTNET\_INTEROP.asp

          K 1 Reply Last reply
          0
          • A AIMrus

            Hy Sandy, I faced a similar problem, and find the solution. In my case, I created a C++ .NET Class Library with Form class and ported to C+++ Builder as an MDI Child. I absolutly sure, your problem can be solved too. Some suggestion: -Create Class library with Form class -Write a public Interface with CreateForm() method -Write a public class which expose the Interface; in the CreateForm() method create a Form and call the form Show() method; -Create a Type Library and register it with regasm.exe -Add the assembly to the GAC with gacutil.exe In the Other DEV Environment: -import type library -create an instance of the public class -Call the CreateForm() method and you'll see a form :) To resolve the MDI child problem -pass the parent handle to the childe + Call SetParent() WinAPI fuction -set the child window style to MDIShilde with the SetWindowLong() WinAPI fuction This guideline is bullshit, I know... You probably dont understand, what I mean... but I tryed. :) I guess, there is a simpler solution to your problem, because you stay in the .NET Framework... If I have some free time, I'll write a tutorial to explain everything... Till then, don't give up... -- modified at 5:13 Friday 27th October, 2006 Useful resources: MSDN .Net Interop articles Exposing .NET Components to COM By Nick Parker. http://www.codeproject.com/dotnet/nettocom.asp Understanding Classic COM Interoperability With .NET Applications By Aravind C. http://www.codeproject.com/dotnet/cominterop.asp .NET - COM Interoperability By KRISHNA PRASAD.N. http://www.codeproject.com/dotnet/COM\_DOTNET\_INTEROP.asp

            K Offline
            K Offline
            ksandy45
            wrote on last edited by
            #5

            Hi, Thanks a lot, i think this will help me a lot. I will just try this concept of yours. I am not totally clear about this concept. i may be needing your total support inorder to carry on. i will be in touch with you. hope you dont mind?

            Thanks & Regards Sandy

            A 1 Reply Last reply
            0
            • K ksandy45

              Hi, Thanks a lot, i think this will help me a lot. I will just try this concept of yours. I am not totally clear about this concept. i may be needing your total support inorder to carry on. i will be in touch with you. hope you dont mind?

              Thanks & Regards Sandy

              A Offline
              A Offline
              AIMrus
              wrote on last edited by
              #6

              Step by step: In VC++: 1. File > New Project > VC++ > CLR > Class Library 2. Right Click on the project > Add > Class Select Windows Form 3. Close Solution In VB: 1. File > New Project > VB > Windows > Windows Application 2. Switch the Form IsMdiContainer property to true 3. Add a MenuStrip to the Form 4. Insert 2 menuitem: -New VC++ Form -Window 5. Select the MenuStrip Set the MdiWindowListItem to WindowToolStripMenuItem 6. In the Solution Explorer right click on the project and Add Referece Go to the Browse tab and find the VC++ dll 7. In 'New VC++ Form' menuitem click event: Dim CppForm As Object CppForm = New VCpp_Form.Form1 CppForm.MdiParent = Me CppForm.Show() Other notes: -It works vice versa. (VB -> VC++) -It is also possible to port the .NET window to other Dev. Environment, but if you leave the .NET Framework it is more complicated than the specific example. Such as I embedded the VC++ Form to the C++ Builder 6, but I'm absolutely sure it works with MFC, VB 6, etc.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups