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 / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

How to add a COM user control to a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Janos - 13 Mar 2008 15:58 GMT
Hi,

I have a COM dll written in C#, I compiled it from its source as .Net2
in VS2008.

It is a User control derived from System.Windows.Forms.UserControl

I compile it as a class library, with COM Interop, VS2008 creates
beutifully dll and tlb for that.

To be able to "run", test an ddebug  it: I added a Windows Form
Project, which will "call" this usercontrol under the same solution.
(Just by Add, New Project, Windows Forms Application. The IDE created
a beautiful empty form.). I added a project reference to the COM
control above (IDE has not allowed to add it as a COM reference.)

How do I add, (or embed) the earlier COM user control into that
beutiful empty Form1?

And: How do I handle  in the Form1 the COM ButtonClicked() event,
which is an
   [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
   public interface IContainerEvents

Any hints appreciated.

Thanks,
Janos
Janos - 13 Mar 2008 18:07 GMT
OK,

found it.

In (my beautiful empty) Form1 after the
InitializeComponent();
just create an instance of the COM control (ccontrl for ex)
and set
ccntrl.Parent = this;

Now up to the com event catching in Form1

Janos

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.