Re: .NET DLL use in VB6
- From: Mike Sharpe <MikeSharpe@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 31 Aug 2006 06:46:02 -0700
This does not help me. I am not looking at using one of the existing .NET
classes. I need to create my own C# class that inherits a VB6 COM interface
from a VB6 DLL and then use this C# DLL that I export to a TLB file in VB6.
The problem is that when I reference the TLB file in VB6, none of the C#
interface is visible. The class is but none of its methods or properties.
My problem is that I cannot specify the inherited interface properties as
public in my C# DLL without the compiler throwing an error.
"sloan" wrote:
.
Try this:
http://msdn.microsoft.com/vbrun/vbfusion/usingnet/default.aspx
"Mike Sharpe" <MikeSharpe@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5A070168-261D-44E9-9628-3BD626567D25@xxxxxxxxxxxxxxxx
We have many old COM classes that are still in use. They were written inbe
VB6. We are now starting to do some things in C# however we cannot just
throw away everything from COM and start over. Our migration to C# will
multi-phase and right now we just need proof of concept. Here's ourwell
situation:
1. We need to create a DLL/TLB in C# that works in VB6
2. C# class needs to implement a VB6 class interface
3. C# class needs to be exported to COM TLB for use in VB6
Here is my basic code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace UserBV
{
[ComVisible(true)]
public class UserBVInput: AlfaBVIO.BVInput
{
[ComVisible(true)]
void AlfaBVIO._BVInput.Initialize(ref DSDataObjects.DSDataType
iSettings)
{
}
[ComVisible(true)]
void AlfaBVIO._BVInput.GetScenarios(string iFileName, ref
System.Array oScenarios)
{
}
public BVInput()
{
}
~BVInput()
{
}
}
[ComVisible(true)]
public class BVOutput : AlfaBVIO.BVOutput
{
public BVOutput()
{
}
~BVOutput()
{
}
[ComVisible(true)]
void AlfaBVIO._BVOutput.Initialize(ref DSDataObjects.DSDataType
iSettings)
{
}
[ComVisible(true)]
void AlfaBVIO._BVOutput.Add(ref DSDataObjects.DSDataType
iFileHeader, ref DSDataObjects.DSDataType iBVSeries)
{
}
[ComVisible(true)]
void AlfaBVIO._BVOutput.Save()
{
}
}
}
I have the project file set according to "Register for COM interop" as
as "Make assembly COM visible". I am able to reference the built TLB filein
a VB6 project but there are no public methods. The VB6 interface that Imust
implement from is called AlfaBVIO.BVInputdo
Can someone please help me? I'm sure to anyone that has experienced this
before it is a no-brainer. This is just the first time I've ever had to
something as odd as this.
- References:
- .NET DLL use in VB6
- From: Mike Sharpe
- Re: .NET DLL use in VB6
- From: sloan
- .NET DLL use in VB6
- Prev by Date: Re: About hard disk with a microcontroller pic
- Next by Date: Re: About hard disk with a microcontroller pic
- Previous by thread: Re: .NET DLL use in VB6
- Next by thread: Re: sending mails
- Index(es):
Relevant Pages
|