I created a simple Control Library, added a component and a form. Added the
following code to the component:
public DialogResult ShowDialog(IWin32Window owner)
{
frmTest test = new frmTest();
return test.ShowDialog(owner);
}
Created an Application project, referenced the component, and added it to
the Application form, added a button, with the following Click Handler:
private void button1_Click(object sender, System.EventArgs e)
{
myComponent1.ShowDialog(this);
}
Works fine for me, and follows the same general pattern of OpenFileDialog.
It sounds to me like you're trying to create the form in the component
constructor. If that's what you really want to do, why don't you test
against Component.DesignMode?
"Michael C#" <xy*@yomomma.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Yeah, umm, thanx.
Now, back to business. Can anyone out there point me to some code samples
of how to create a component that creates a form? The tests I ran last
night had some issues including one in which the form tried to instantiate
itself during design time. Thank you.
"Sean Hederman" <us***@blogentry.com> wrote in message
news:cu**********@ctb-nnrp2.saix.net... The OpenFileDialog is not a Windows Form, it is a Component that creates
and displays a form when a certain method is called. I suggest you read
up on creating controls and components. Those sections of the
documentation should have information on how to make a component appear
in the toolbox.
"Michael C#" <xy*@abcdef.com> wrote in message
news:LS*****************@fe08.lga...I have a Windows Form I want to add to another form similar to the way
you add an OpenFileDialog to a Windows Form from the Toolbox.
Thx