I have a C# DLL that is being used as a class to contain a list of properties about a file.
The C# DLL is COM visible, and is able to be declared and instantiated in VB6.
Inside my vb6 function where I create the object..
Dim fileObj As New MyCSharpClass.FileProperties
I am immediately able to see all the different properties accessible to my C# FileProperties object.
fileObj.(intellisense) shows me the dropdown list of anything available inside the object
But when I pass my object to a function..
GetProperties(fileObj)
When I am inside GetProperties
Public Function GetProperties(ByRef pfileObj As MyCSharpClass.FileProperties)
When I try to have intellisense show me what options are available to me..
it does now recognize pfileObj as a variable I can use, it will not show up in intellisense
If I try to manually type it out, once again intellisense will not show me any options.
pfileObj.
Is there a special way to pass COM interropt objects around to functions they were not delcared in inside of VB6?
Is this simply not possible?
I was trying to avoid creating functions that return strings, and then assign to the object properties one at a time.
The reason is because you need to have .NET create a TypeLib file which you can then reference from VB6. VB6 will use this to display intellisense as well as assist VB6 in how to invoke your C# object. You need to do the following items:
You can find the detailed instructions here: http://www.codeproject.com/Articles/3511/Exposing-NET-Components-to-COM . The article may be old but for the most part it is still applicable to the modern versions of Visual Studio.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.