We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Null pointer exception with SetDockIcon where DockingManager on UserControl

Thread ID:





56463 Feb 15,2007 01:20 PM UTC Feb 16,2007 11:34 AM UTC WinForms 2
Tags: Tools
James Sandys-Lumsdaine
Asked On February 15, 2007 01:20 PM UTC

I have seen a similar post (link below) but this is old and seemed not to be resolved:


I'm using 4.4 and have reproduced the problem with the example in this post:


Here the docking manager is held on a UserControl so to allow it to co-exist with the ToolStripContainer control. However, placing the following code:

Icon icon = new Icon(@"Redo.ico");
dockingManager1.SetDockIcon(treeView1, icon);

in the Constructor or OnLoad() method gives a null pointer.

I have used the SetDockIcon method successfully when I had the docking manager on a Form but since I need to follow the above example and use a UserControl, I've run into this problem.

Anything I'm doing wrong or is this a bug?

Thanks in advance,


Murugan [Syncfusion]
Replied On February 16, 2007 01:28 AM UTC

Hi James,

UserControl_OnLoad is not the correct place to do customization of DockingManager. Please refer to the below KB and let me know if it helps.

Is the Form.Load event handler a good place to perform custom initialization of the docking layout?

Code snippet:

private void dockingManager1_NewDockStateEndLoad(object sender, EventArgs e)
if (this.flag)
this.flag = false;
Icon iIcon = new Icon("App.ico");
this.dockingManager1.SetDockIcon(this.treeView1, iIcon);

Thank you for using Syncfusion products.

Murugan P.S

Administrator [Syncfusion]
Replied On February 16, 2007 11:34 AM UTC

Thanks for the reply. Although that method solved the problem for setting the icon at load up time, it didn't offer any help for programatically added panels since the event never fired again. Even if it did, it doesn't passed any information in the EventArgs (apart from a bool LoadResult) indicating which control I would need to set the icon on.

I'm not sure why but my problem has gone away - after the MainForm is loaded and the user clicks on something, programatically adding a docked control and setting it's icon now works. Why this is causing an exception before I don't know - the UserControl holding the DockingManager has moved projects so maybe there was a resource issue with the Icons...

I'll keep an eye on it and come back if it occurs again.




This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon