Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exposing Form class methods to COM

Status
Not open for further replies.

yatingg

Programmer
Jan 20, 2004
5
US
Hi, I'm new to C# and the C family languages. I would like to know how I can expose the Show() & Hide() from the Form class to COM. Currently, I have an interface and a class that inherits Form and this interface. More specifically, how do I implement the Show() & Hide()? I know how to do Property1 because it's my property, but Show() & Hide() are from the Form class and I don't know where or how to implement it. Thanks in advance.

---------------------------

[GuidAttribute("3C1565B0-29B8-448e-B7AD-D36362989640")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
[ComVisible(true)]
public interface IMyInterface
{
void Hide(); // is this correct?
void Show(); // is this correct?
bool Property1 {get; set;}
}

[GuidAttribute("E6B3EFC1-527A-4024-862F-5588F34BF28F")]
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
public class SplashForm : Form, IMyInterface
{
public SplashForm()
{
public bool Property1
{
get { return tmrShowSplash.Enabled; }
set { tmrShowSplash.Enabled = value; }
}
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top