Home Forums WinForms controls Other WinForms controls DockingWindows on a Control Reply To: DockingWindows on a Control

User (Old forums)
Post count: 23064

Andre, Thank you for your response,

I created a Windows Control Library Project. Below is the bare basics of the code of this control.

public partial class UserControl1 : UserControl
//declaring the layoutmanager
private DockLayoutManager _layoutManager;
public UserControl1()
this.Name = “Fred”;

_layoutManager = new DockLayoutManager( this, null );
_layoutManager.AllowDocking = false;
_layoutManager.AllowFloating = false;
_layoutManager.AllowHide = false;
_layoutManager.AllowAutoHide = true;

private void CreateBasicToolWindow()
//create some test controls
GroupBox gb = new GroupBox();
gb.Name = “gbTest”;
gb.Text = “TEST”;
CheckBox ocb = new CheckBox();
ocb.Name = “cbTest”;
ocb.Text = “Test CB: “;
ocb.Dock = DockStyle.Top;
//Add it to the groupbox
gb.Controls.Add( ocb );
//Create the toolwindow and add the control
ToolWindow oTW = new ToolWindow( gb, “PlotDetails” );
oTW.Name = “namecontrol”;
oTW.Text = “ToolBox”;
//Add the toolwindow obj to the layoutmanager
*****Errors here _layoutManager.ToolWindows.Add( oTW );

This code will not work….

When I attempt to add a Toolwindow object to the Layoutmanager, it gives me the following error.

Failed to create UserControl ‘controlTest.UserControl1’
The error message was ‘Value cannot be null. Parameter name: owner’

Imported from legacy forums. Posted by toedwy (had 588 views)