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.
Unfortunately, activation email could not send to your email. Please try again.

Null pointer exception with SetDockIcon where DockingManager on UserControl

Thread ID:

Created:

Updated:

Platform:

Replies:

56463 Feb 15,2007 08:20 AM Feb 16,2007 06:34 AM Windows Forms 2
loading
Tags: Tools
James Sandys-Lumsdaine
Asked On February 15, 2007 08:20 AM

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

http://www.syncfusion.co.in/support/forums/message.aspx?MessageID=30838

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

http://www.syncfusion.com/support/forums/message.aspx?MessageID=44345

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,

Jas.

Murugan [Syncfusion]
Replied On February 15, 2007 08:28 PM

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.

Regards,
Murugan P.S

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

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.

Thanks,

Jas.


CONFIRMATION

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.

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.

;