473,324 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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
1 2092
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: steve | last post by:
Hi All I have a VB.net 2005 App which has a form set as the Application splash screen in Project properties Another form is set as the startup form All works great until the splash screen...
2
by: Nadav Popplewell | last post by:
Hi Everybody, I've got a strange problem with TreeView Control in ASP.NET. The Controls Tree I've got on my page is like this: MasterPage Content View2 ]
11
by: AG | last post by:
Hi all, New install of VS 2005 Pro (SP1) on new machine with Windows XP Pro SP2, Core 2 Extreme Quad Core processor, 4GB RAM. Trying to debug a Web Application Project. I had no problems...
7
by: Cirene | last post by:
I used to use the Web Deployment Project with my VS2005 projects. Now I've fully upgraded to VS2008. Do I have to download a new version of the Web Deployment Project? If so where can I find...
2
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have no idea where to post this question, or even if its appropriate for me to post it here. I don't know if installing a VB.Net program has caused the problem I'm having or not. All I know is I...
14
by: Mohamed Mansour | last post by:
Hey there, this will be somewhat a long post, but any response is appreciated! I have done many PInvoke in the past from C++ to C#, but I did PInvoke within C# not C++/CLI. Can someone explain...
11
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have worked with application settings in VS2005 and C# for awhile, but usually with standard types. I have been trying to store a custom container/class/type in an application setting and I have...
5
by: Simon | last post by:
I have problem with namespaces. I have a program that consumes the web service and has for instance names space nsProgram. In this program I have defined several classes that I use for storing and...
9
by: metalheadstorm | last post by:
This is Urgent! :) Ok im using Ms Access (2002) as the backend to a program i have developted in vb6, this is for a college project and im currently at the business that this poposed program is...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.