Windows Develop Bookmark and Share   
 index > Windows Forms Designer > How to put a pop-up box control into Toolbox?
 

How to put a pop-up box control into Toolbox?

I have made some Control, that is an About Box form. Now, I want to add it into my Toolbox, so I can drag and drop it into my solution and use as any other dialog (e.g. FileDialog). When I want to add it (.dll) into Toolbox, I get an error, that there is nothing to add to toolbox in this control.

I assume, that by deafults IDE thinks that it is a graphical control, so how to indicate that it is a dialog? I have tried to derivate from CommonDialog but It didn't work.


bucz  Friday, July 27, 2007 9:08 AM

Hi, bucz,

Yes, you should inherit from CommonDialog.

For example,

Code Snippet

public partial class CustomControl1 : CommonDialog

{

Form newform;

public CustomControl1()

{

InitializeComponent();

this.Reset();

newform = new Form();

newform.StartPosition = FormStartPosition.CenterParent;

newform.Text = "About";

newform.Width = 200;

newform.Height = 100;

}

protected override bool RunDialog(IntPtr hwndOwner)

{

newform.ShowDialog();

return true;

}

public override void Reset()

{

if (newform != null)

{

newform.Dispose();

}

}

}

Hi, bucz,

Yes, you should inherit from CommonDialog.

For example,

Code Snippet

public partial class CustomControl1 : CommonDialog

{

Form newform;

public CustomControl1()

{

InitializeComponent();

this.Reset();

newform = new Form();

newform.StartPosition = FormStartPosition.CenterParent;

newform.Text = "About";

newform.Width = 200;

newform.Height = 100;

}

protected override bool RunDialog(IntPtr hwndOwner)

{

newform.ShowDialog();

return true;

}

public override void Reset()

{

if (newform != null)

{

newform.Dispose();

}

}

}

You can use google to search for other answers

Custom Search

More Threads

• How to Open "Find And Replace" Dialog Box in VB.Net?
• How to add Backgroung Image of panel at particuler position
• IDE Shrunk form on restart, making controls inaccessible
• Windows Form Inherits
• Design Issue with TypeConverter for a Collection Item.
• Setting Colors By Reference
• Referencing Label Objects
• Mmicrosoft Outlook Integration with VB.NET Code
• After running application (F5) Controls disappear from designer, now invisible
• Resizing Panels with splitter control