Passing Structures from C++ to a VB .NET DLL

Discussion in 'C Programming' started by gstarr, Feb 12, 2010.

  1. gstarr

    gstarr

    Joined:
    Feb 12, 2010
    Messages:
    1
    I'm having trouble getting the correct syntax for passing a structure from C++ to VB .NET.

    I have a VB .Net DLL program with the following code:

    Public Structure testParams
    Public iFirst As Integer
    Public iSecond As Integer
    End Structure

    Public Class clsKpdUI
    Public Function ShowForm(ByVal Param1 As testParams) As Integer
    ' Code
    End Function
    End Class

    I have C++ program with the following code:

    struct testParams {
    int iFirst;
    int iSecond;
    };

    kpdUI::clsKpdUI myUI;
    testParams tp;
    tp.iFirst = 4;
    tp.iSecond = 3;
    myintR = myUI.ShowForm3(tp);

    When I try to compile the C++ code, I get the following Error:
    Error 1 error C2664: 'kpdUI::clsKpdUI::ShowForm' : cannot convert parameter 1 from 'testParams' to 'kpdUI::testParams' c:\test\Form1.h 133 TestKpdUIcpp

    How do I correct this error?
    gstarr, Feb 12, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anushi
    Replies:
    5
    Views:
    8,636
  2. John Phung
    Replies:
    3
    Views:
    623
    Karl Heinz Buchegger
    Feb 26, 2004
  3. tweak
    Replies:
    14
    Views:
    2,767
    Eric Sosman
    Jun 11, 2004
  4. Alfonso Morra
    Replies:
    11
    Views:
    703
    Emmanuel Delahaye
    Sep 24, 2005
  5. H. Simpson
    Replies:
    4
    Views:
    247
    H. Simpson
    Aug 3, 2004
Loading...

Share This Page