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 / June 2006

Tip: Looking for answers? Try searching our database.

Hiding Methods in Automation Add-In

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthew Wieder - 22 Jun 2006 22:03 GMT
In VS 2005 and Excel 2003.  I am writing an Automation Add-In in C# and don't
want to expose the Object methods (GetHashCode, GetType etc.) to end users to
put in their cell formulas.  A post here
http://groups.google.com/group/microsoft.public.dotnet.framework.interop/browse_
frm/thread/fbc3f32a59e8b9e1/d036a59ead000e62
?

suggests marking the class as ClassInterfaceType.None and implementing a
public interface with just the desired methods but this does not work (maybe
it worked in .NET 1.1).  Help?
Dmytro Lapshyn [MVP] - 23 Jun 2006 11:22 GMT
Hi Matthew,

Check that the public interface is marked as
ComInterfaceType.InterfaceIsDual or at least
ComInterfaceType.InterfaceIsDispatch (with the [InterfaceType] attribute).

Signature

Regards,
Dmytro Lapshyn [MVP]
http://blogs.vbcity.com/DmytroL

> In VS 2005 and Excel 2003.  I am writing an Automation Add-In in C# and
> don't
[quoted text clipped - 7 lines]
> (maybe
> it worked in .NET 1.1).  Help?
Matthew Wieder - 23 Jun 2006 13:31 GMT
The interface is set to dual - the functions still do not show up in the
Insert Function dialog in Excel.  Does anyone have this working in .NET 2.0?

> Hi Matthew,
>
> Check that the public interface is marked as
> ComInterfaceType.InterfaceIsDual or at least
> ComInterfaceType.InterfaceIsDispatch (with the [InterfaceType] attribute).
Matthew Wieder - 23 Jun 2006 14:53 GMT
Solved it - Based on web examples, I had been implementing my class as:

public class myClass : Object, MyInterface, Extensibility.IDTExtensibility2

which makes the primary interface the object type and that was causing
the problems.  Changed to:
public class myClass : MyInterface, Extensibility.IDTExtensibility2

and only the desired methods are showing in Excel now.

thanks.

> The interface is set to dual - the functions still do not show up in the
> Insert Function dialog in Excel.  Does anyone have this working in .NET
[quoted text clipped - 6 lines]
>> ComInterfaceType.InterfaceIsDispatch (with the [InterfaceType]
>> attribute).

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.