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 reference exception using SetDockIcon

Thread ID:

Created:

Updated:

Platform:

Replies:

30838 Jun 24,2005 10:44 AM Jul 7,2005 09:30 AM Windows Forms 6
loading
Tags: Tools
Mike Witt
Asked On June 24, 2005 10:44 AM

Hello, I am attempting to assign an icon to a docked control during the initialization process. Note, I am using the System.Drawing.Icon overload. When I do this, I get the following exception: An unhandled exception of type ''System.NullReferenceException'' occurred in syncfusion.tools.windows.dll Additional information: Object reference not set to an instance of an object. The code I am using, looks like this: // Note, I''ve extended the DockingManager, so "this" is the DockingManager. this.DockControl(control, this.Parent, dockStyle, initialSize); this.SetDockLabel(control, labelControl.Label); System.Drawing.Icon icon = this.appContainer.GetImageIcon(labelControl.IconList, labelControl.IconName); if (icon != null) this.SetDockIcon(control, icon); I would appreciate any help or insight into this matter. Thanks, Mike

Administrator [Syncfusion]
Replied On June 28, 2005 08:49 AM

Hi Mike, I tested for this issue here but was not able to reproduce your problem. I have attached the sample used for testing. Please let me know if you are able to reproduce the problem using the test sample. Also,Let me know if you have any questions regarding this. Thanks, Vijay. >Hello, I am attempting to assign an icon to a docked control during the initialization process. Note, I am using the System.Drawing.Icon overload. When I do this, I get the following exception: > >An unhandled exception of type ''System.NullReferenceException'' occurred in syncfusion.tools.windows.dll > >Additional information: Object reference not set to an instance of an object. > >The code I am using, looks like this: > >// Note, I''ve extended the DockingManager, so "this" is the DockingManager. >this.DockControl(control, this.Parent, dockStyle, initialSize); >this.SetDockLabel(control, labelControl.Label); >System.Drawing.Icon icon = this.appContainer.GetImageIcon(labelControl.IconList, labelControl.IconName); >if (icon != null) this.SetDockIcon(control, icon); > >I would appreciate any help or insight into this matter. > >Thanks, Mike

Administrator [Syncfusion]
Replied On June 28, 2005 09:05 AM

Hi Mike, I just forgot to attach the sample in my previous response. http://syncfusion.net/ExternalSupport/Tools/2005/June/F20876AHTabBackColor.zip Thanks, Vijay >Hello, I am attempting to assign an icon to a docked control during the initialization process. Note, I am using the System.Drawing.Icon overload. When I do this, I get the following exception: > >An unhandled exception of type ''System.NullReferenceException'' occurred in syncfusion.tools.windows.dll > >Additional information: Object reference not set to an instance of an object. > >The code I am using, looks like this: > >// Note, I''ve extended the DockingManager, so "this" is the DockingManager. >this.DockControl(control, this.Parent, dockStyle, initialSize); >this.SetDockLabel(control, labelControl.Label); >System.Drawing.Icon icon = this.appContainer.GetImageIcon(labelControl.IconList, labelControl.IconName); >if (icon != null) this.SetDockIcon(control, icon); > >I would appreciate any help or insight into this matter. > >Thanks, Mike

Mike Witt
Replied On June 28, 2005 11:34 AM

Hi Vijay, I tried your example and it worked without a problem. My situation is a bit different. Our custom docking manager is responsible for querying some configuration settings and it enables docking for the controls and sets the attributes (such as labels, icons, etc.). This all works, except for the icon. I have changed your Form1.cs to show you what I mean. Thanks for your help... Mike F20876AHTabBackColor-Mike_7534.zip > >Hi Mike, > I just forgot to attach the sample in my previous response. > http://syncfusion.net/ExternalSupport/Tools/2005/June/F20876AHTabBackColor.zip > >Thanks, >Vijay > >>Hello, I am attempting to assign an icon to a docked control during the initialization process. Note, I am using the System.Drawing.Icon overload. When I do this, I get the following exception: >> >>An unhandled exception of type ''System.NullReferenceException'' occurred in syncfusion.tools.windows.dll >> >>Additional information: Object reference not set to an instance of an object. >> >>The code I am using, looks like this: >> >>// Note, I''ve extended the DockingManager, so "this" is the DockingManager. >>this.DockControl(control, this.Parent, dockStyle, initialSize); >>this.SetDockLabel(control, labelControl.Label); >>System.Drawing.Icon icon = this.appContainer.GetImageIcon(labelControl.IconList, labelControl.IconName); >>if (icon != null) this.SetDockIcon(control, icon); >> >>I would appreciate any help or insight into this matter. >> >>Thanks, Mike

Mike Witt
Replied On July 6, 2005 01:11 PM

Hi Vijay, Just wondering if you had a chance to look at the code changes I made to demonstrate what we are doing? This is still a problem for us and if you have any other ideas ... I''d certainly appreciate hearing about them. Mike

Administrator [Syncfusion]
Replied On July 6, 2005 06:10 PM

Hi Mike I have a quick look to your code: The two panels are not in the controls collection of Form1. These methods will fail: this.SetAutoHideMode(control, true); this.SetDockIcon(control,icon); Switch the Syncfusion environment to the Debug mode and you''ll see the asserts. Furthermore, I have to check the DesignMode, otherwise the code is executing when the form opens in the designer. The path is different in the design/runtime mode, so an exception will be thrown. private void dockingManager1_NewDockStateEndLoad(object sender, System.EventArgs e) { //this.dockingManager1.SetAutoHideMode(this.pnlpanel1, true); if( !this.DesignMode ) { this.dockingManager1.CustomSetDockIcon(this.pnlpanel2 , new Icon("..\\..\\sftools.ico")); this.dockingManager1.CustomSetDockIcon(this.pnlpanel1 , new Icon("..\\..\\sftools.ico")); } } Regards, Thomas >Hi Vijay, > >Just wondering if you had a chance to look at the code changes I made to demonstrate what we are doing? This is still a problem for us and if you have any other ideas ... I''d certainly appreciate hearing about them. > >Mike

Mike Witt
Replied On July 7, 2005 09:30 AM

Hi Thomas, Thanks for your suggestions, I will look. The code your are looking at is my reworking of Vijay''s example to show how we are doing this, so it is not my actual code (which is more complicated). I would not have a problem with the icon paths as I''m using an image list and generating the icon from there. Setting everything else on the docking manager works without a problem. Here is my actual code if you would be willing to take a look: // Look for children to put in as tabbed controls int counter=0; foreach (HISOFTControlInfo controlInfo in parentPanel.ChildControlList.Values) { System.Windows.Forms.Control child = controlInfo.Control as System.Windows.Forms.Control; if (controlInfo.InitialSize > 0) initialSize = controlInfo.InitialSize; configControl.LastChildLink = controlInfo; if (counter == 0) { this.DockControl(child, parentControl, dockStyle, initialSize); } else { this.DockControl(child, parentControl, DockingStyle.Tabbed, initialSize); } this.SetDockLabel(child, controlInfo.Label); System.Drawing.Icon icon = this.appContainer.GetImageIcon(controlInfo.IconList, controlInfo.IconName); if (icon != null) this.SetDockIcon(child, icon); parentControl = child; this.SetAutoHideMode(child, parentPanel.IsHidden); this.SetCloseButtonVisibility(child, false); counter++; } Thanks for any help! Mike

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.

;