<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Passing reference from C# to VB dll in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828539#M79726</link>
    <description>Hi All,&lt;BR /&gt;
            I have written a Function in VB6.0 and made it as a dll. I have given this dll as a reference to a C# application. I have to pass an object to this VB dll as a parameter from C#. But i am getting error while passing the object. Here is the Coding&lt;BR /&gt;
&lt;BR /&gt;
DemoProject.DemoClass DP = new DemoProject.DemoClass();                       Autodesk.AutoCAD.Interop.Common.AcadObject Obj = e.DBObject;&lt;BR /&gt;
 DP.GetObjFromParent(ref Obj );&lt;BR /&gt;
&lt;BR /&gt;
I am getting error at above line. Any help would be greatly appreciated. Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Basha</description>
    <pubDate>Tue, 28 Nov 2006 13:59:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-11-28T13:59:42Z</dc:date>
    <item>
      <title>Passing reference from C# to VB dll</title>
      <link>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828539#M79726</link>
      <description>Hi All,&lt;BR /&gt;
            I have written a Function in VB6.0 and made it as a dll. I have given this dll as a reference to a C# application. I have to pass an object to this VB dll as a parameter from C#. But i am getting error while passing the object. Here is the Coding&lt;BR /&gt;
&lt;BR /&gt;
DemoProject.DemoClass DP = new DemoProject.DemoClass();                       Autodesk.AutoCAD.Interop.Common.AcadObject Obj = e.DBObject;&lt;BR /&gt;
 DP.GetObjFromParent(ref Obj );&lt;BR /&gt;
&lt;BR /&gt;
I am getting error at above line. Any help would be greatly appreciated. Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Basha</description>
      <pubDate>Tue, 28 Nov 2006 13:59:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828539#M79726</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-28T13:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Passing reference from C# to VB dll</title>
      <link>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828540#M79727</link>
      <description>What does the VB DLL function look like? What type is the argument of the &lt;BR /&gt;
function? What is the error? It seems that the VB DLL function does not &lt;BR /&gt;
recognise the type DBObject in Autodesk.AutoCAD.DatabaseServices namespace &lt;BR /&gt;
(of course).&lt;BR /&gt;
&lt;BR /&gt;
Assume the VB DLL function's argument is a AcadObject type, like&lt;BR /&gt;
&lt;BR /&gt;
Public Function GetObjFromParent(obj As AcadObject) As ....&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Then you should pass an AcadObject, not DBObject. Since DBObject and Entity &lt;BR /&gt;
object in Autodesk.AutoCAD.Database Services namespace have a property &lt;BR /&gt;
"AcadObject", which returns Acad COM object "AcadObject", you could try &lt;BR /&gt;
this:&lt;BR /&gt;
&lt;BR /&gt;
Autodesk.AutoCAD.Interop.Common.AcadObject Obj = e.DBObject.AcadObject;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BASHA sk=""&gt; wrote in message news:5408074@discussion.autodesk.com...&lt;BR /&gt;
Hi All,&lt;BR /&gt;
            I have written a Function in VB6.0 and made it as a dll. I have &lt;BR /&gt;
given this dll as a reference to a C# application. I have to pass an object &lt;BR /&gt;
to this VB dll as a parameter from C#. But i am getting error while passing &lt;BR /&gt;
the object. Here is the Coding&lt;BR /&gt;
&lt;BR /&gt;
DemoProject.DemoClass DP = new DemoProject.DemoClass(); &lt;BR /&gt;
Autodesk.AutoCAD.Interop.Common.AcadObject Obj = e.DBObject;&lt;BR /&gt;
 DP.GetObjFromParent(ref Obj );&lt;BR /&gt;
&lt;BR /&gt;
I am getting error at above line. Any help would be greatly appreciated. &lt;BR /&gt;
Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Basha&lt;/BASHA&gt;</description>
      <pubDate>Tue, 28 Nov 2006 14:58:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828540#M79727</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-28T14:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Passing reference from C# to VB dll</title>
      <link>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828541#M79728</link>
      <description>Hi Norman,&lt;BR /&gt;
&lt;BR /&gt;
My function in VB look like below&lt;BR /&gt;
 Public Function GetObjFromParent(Fname as String, Obj As  AcadObject)&lt;BR /&gt;
     ' My Stuff &lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
My function in C#.Net look like this&lt;BR /&gt;
&lt;BR /&gt;
public void objAppended(object o, ObjectEventArgs e)&lt;BR /&gt;
               {&lt;BR /&gt;
  DemoProject.DemoClass DP= new DemoProject.DemoClass();&lt;BR /&gt;
     string Fname = "E:\\New Demo\\Demo.xml";&lt;BR /&gt;
     Autodesk.AutoCAD.Interop.Common.AcadObject Obj = e.DBObject.AcadObject;&lt;BR /&gt;
    DP.GetObjFromParent(ref Fname,ref Obj );&lt;BR /&gt;
            }&lt;BR /&gt;
Error1: Cannot implicitly convert type 'object' to 'Autodesk.AutoCAD.Interop.Common.AcadObject'. An explicit conversion exists (are you missing a cast?).&lt;BR /&gt;
Error2: No overload for method 'GetObjFromParent' takes '2' arguments&lt;BR /&gt;
&lt;BR /&gt;
 Hope this clearly explains my problem.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Basha</description>
      <pubDate>Wed, 29 Nov 2006 06:11:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828541#M79728</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-29T06:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Passing reference from C# to VB dll</title>
      <link>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828542#M79729</link>
      <description>Sorry for the minor mistake in my previous reply:&lt;BR /&gt;
&lt;BR /&gt;
DBObject's AcadObject property is actually returns an object of "object" &lt;BR /&gt;
type, not "AcadObject" type, although the property is named AcadObject. So, &lt;BR /&gt;
you need explicitly cast it as AcadObject before assigning it to an &lt;BR /&gt;
AcadObject variable:&lt;BR /&gt;
&lt;BR /&gt;
Autodesk.AutoCAD.Interop.Common.AcadObject Obj = &lt;BR /&gt;
(Autodesk.AutoCAD.Interop.Common.AcadObject) e.DBObject.AcadObject;&lt;BR /&gt;
&lt;BR /&gt;
As for Error2, in your original post, the VB function has only one argument, &lt;BR /&gt;
have you re-written the VB DLL but forgotten to update the reference?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BASHA sk=""&gt; wrote in message news:5409039@discussion.autodesk.com...&lt;BR /&gt;
Hi Norman,&lt;BR /&gt;
&lt;BR /&gt;
My function in VB look like below&lt;BR /&gt;
 Public Function GetObjFromParent(Fname as String, Obj As  AcadObject)&lt;BR /&gt;
     ' My Stuff&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
My function in C#.Net look like this&lt;BR /&gt;
&lt;BR /&gt;
public void objAppended(object o, ObjectEventArgs e)&lt;BR /&gt;
               {&lt;BR /&gt;
  DemoProject.DemoClass DP= new DemoProject.DemoClass();&lt;BR /&gt;
     string Fname = "E:\\New Demo\\Demo.xml";&lt;BR /&gt;
     Autodesk.AutoCAD.Interop.Common.AcadObject Obj = e.DBObject.AcadObject;&lt;BR /&gt;
    DP.GetObjFromParent(ref Fname,ref Obj );&lt;BR /&gt;
            }&lt;BR /&gt;
Error1: Cannot implicitly convert type 'object' to &lt;BR /&gt;
'Autodesk.AutoCAD.Interop.Common.AcadObject'. An explicit conversion exists &lt;BR /&gt;
(are you missing a cast?).&lt;BR /&gt;
Error2: No overload for method 'GetObjFromParent' takes '2' arguments&lt;BR /&gt;
&lt;BR /&gt;
 Hope this clearly explains my problem.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Basha&lt;/BASHA&gt;</description>
      <pubDate>Wed, 29 Nov 2006 14:08:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828542#M79729</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-29T14:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Passing reference from C# to VB dll</title>
      <link>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828543#M79730</link>
      <description>Hi Norman,&lt;BR /&gt;
                   Thank you for your time. Actually i am passing two parameters, one is the string and the other is an object. In my original post i haven't specified the 1st argument. Now the first error was resolved but still i am getting the 2nd error.&lt;BR /&gt;
&lt;BR /&gt;
Error2: No overload for method 'GetObjFromParent' takes '2' arguments&lt;BR /&gt;
&lt;BR /&gt;
 Thanks in Advance,&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Basha</description>
      <pubDate>Thu, 30 Nov 2006 06:32:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/passing-reference-from-c-to-vb-dll/m-p/1828543#M79730</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-30T06:32:17Z</dc:date>
    </item>
  </channel>
</rss>

