Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / March 2008

Tip: Looking for answers? Try searching our database.

Help on Com DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Q. John Chen - 18 Mar 2008 16:41 GMT
I am trying to make a .NET class (.NET 2.0/C#)  to be used in VB6.

I created Class Library Project with the following Class(below). After
build, I am able to reference the Class. See the TestClass in Object
Browser. But I can see the DoTest() method. I wasted hours and still
can't figure it out.
-----

using System;
using System.Collections.Generic;
using System.Text;

using System.Runtime.InteropServices;

namespace ComDllTest
{
   [Guid("701F1709-3B9F-4b2e-AF81-686D2C08F015")]
   public class TestClass
   {
       public TestClass()
       {
       }

       public void DoTest()
       {
           return;
       }

   }
}
Q. John Chen - 18 Mar 2008 17:02 GMT
I found the answer from this group:

Christian Fröschlin
View profile
    More options Feb 2 2004, 11:05 am
Newsgroups: microsoft.public.dotnet.framework.interop
From: Christian Fröschlin <froesch...@mvtec.com>
Date: Mon, 02 Feb 2004 17:05:46 +0100
Local: Mon, Feb 2 2004 11:05 am
Subject: Re: Public .Net method not visible in COM app
Reply to author | Forward | Print | Individual message | Show original
| Report this message | Find messages by this author
Sun Murthy wrote:

> I followed MSDN examples to create a .Net component library and a
CCW
> for it. I then proceed to use the CCW in a VB6 app. I see the .Net
> library listed as a reference in the VB 6 project, I can include
that
> reference and instantiate that object. However, none of the public
> methods in the .Net component are visible to the VB app. What am I
> missing?

Have you tried calling the methods or did you just look at
IntelliSense?
By default, only an IDispatch interface for late binding is exposed,
and
the members cannot be listed by VB. Use the ClassInterfaceType
attribute
(e.g. AutoDual), or even better define explicit interfaces.

Have a look at

  http://www.dotnetinterop.com/faq/?q=ClassInterface

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.