467,882 Members | 1,182 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,882 developers. It's quick & easy.

Problems importing C# DLL into VB6.0 project (urgent)

em
Hi all,

I'm getting some problems importing a DLL that I made in C# within VB6.0.
The C# is quite easy, just for trying:

namespace TestDll
{

public class Class1

{
public int SumNumbers(int numn1, int num2)
{
int sum = num1 + num2;
return sum;
}
}
}

I developd the C# project as a Project Library, so the DLL is correctrly
created.
I don't have any problem if I use the DLL within a C# project.
Whereas, if I use the DLL in a VB6.0 project it doesn't work. The class is
correctly imported and I can create an object of that class, but it is not
possible to access at the method (SumNumbers).
In the project properties I setted the 'Register for COM Interop' as true,
but I tried both, true and false, and it doesn't work.

Any suggestions?

Thank you very much in advance.
Nov 17 '05 #1
  • viewed: 1792
Share:
1 Reply
You need to define carefully your interfaces if you want your COM object to
work. Not an easy answer, you have to study about COM interop.

There is lot of stuff on the MSDN.

In WROX web site, in the section related to the book "Professional C# 3rd
edition", there is same sample code that you can download. Look at the code
rel;ated to Chapter 28 (actually, I think having the book would help).

Alternatively, do a search on google for "Interop COM C#"

Cheers,
Fabio
"em" <em@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
Hi all,

I'm getting some problems importing a DLL that I made in C# within VB6.0.
The C# is quite easy, just for trying:

namespace TestDll
{

public class Class1

{
public int SumNumbers(int numn1, int num2)
{
int sum = num1 + num2;
return sum;
}
}
}

I developd the C# project as a Project Library, so the DLL is correctrly
created.
I don't have any problem if I use the DLL within a C# project.
Whereas, if I use the DLL in a VB6.0 project it doesn't work. The class is
correctly imported and I can create an object of that class, but it is not
possible to access at the method (SumNumbers).
In the project properties I setted the 'Register for COM Interop' as true,
but I tried both, true and false, and it doesn't work.

Any suggestions?

Thank you very much in advance.

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Nadav Popplewell | last post: by
11 posts views Thread by AG | last post: by
2 posts views Thread by =?Utf-8?B?R3JlZw==?= | last post: by
11 posts views Thread by =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post: by
5 posts views Thread by Simon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.