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. Image for the cookie policy date
close icon

Null Ref Exception in docking code

With the following code, I am able to create a situation in which I get a null reference exception. To reproduce, paste this into a load event on a form. Control ctrl1 = new ListView(); Control ctrl2 = new ListView(); Control ctrl3 = new ListView(); Control ctrl4 = new ListView(); Control ctrl5 = new ListView(); m_DockingManager = new DockingManager(); m_DockingManager.BeginInit(); m_DockingManager.HostForm = this; m_DockingManager.DockToFill = true; m_DockingManager.DockControl(ctrl1, this, DockingStyle.Fill, 200); m_DockingManager.DockControl(ctrl2, ctrl1, DockingStyle.Right, 200); m_DockingManager.DockControl(ctrl3, ctrl2, DockingStyle.Tabbed, 200); m_DockingManager.DockControl(ctrl4, ctrl2, DockingStyle.Tabbed, 200); m_DockingManager.DockControl(ctrl5, ctrl1, DockingStyle.Bottom, 200); m_DockingManager.SetDockLabel(ctrl1, "ctrl1"); m_DockingManager.SetDockLabel(ctrl2, "ctrl2"); m_DockingManager.SetDockLabel(ctrl3, "ctrl3"); m_DockingManager.SetDockLabel(ctrl4, "ctrl4"); m_DockingManager.SetDockLabel(ctrl5, "ctrl5"); m_DockingManager.EndInit(); Run the app. Double click on the pane labeled "ctrl4" and it undocks. Double click on it again and it will cause the exception. I am using version 3.0.1.0. Any help would be greatly appreciated.

4 Replies

AD Administrator Syncfusion Team June 28, 2005 06:28 PM UTC

Hi Gus, There were a few issues in v3.0.1.0 that caused DockingManager to throw exceptions. These fixes, along with a number of other fixes, are included in v3.2.1.0 and I would recommend upgrading if possible. Regards, Gregory Austin Syncfusion Inc.


GF Gus Felderhoff July 1, 2005 05:17 PM UTC

Thank you Gregory. I did as you recommended, and no longer get the exception. Although, now when I follow the steps outlined in the original post, the individual panes that were tabbed before undocking are now untabbed when redocking. Is there a way around this?


GF Gus Felderhoff July 1, 2005 05:20 PM UTC

In addition, now when I first bring up my application, the code posted above does not display any windows on my form.


GF Gus Felderhoff July 5, 2005 04:01 PM UTC

I have found a work around in which everything works as expected. I have used a DockingClientPanel for the ''main'' panel within my form. Control ctrl1 = new ListView(); Control ctrl2 = new ListView(); Control ctrl3 = new ListView(); Control ctrl4 = new ListView(); Control ctrl5 = new ListView(); DockingClientPanel panel; this.components = new System.ComponentModel.Container(); m_DockingManager = new DockingManager(); m_DockingManager.BeginInit(); panel = new DockingClientPanel(); panel.SizeToFit = true; this.Controls.Add(panel); m_DockingManager.HostForm = this; m_DockingManager.ThemesEnabled = true; panel.Size = this.ClientSize; ctrl1.Dock = DockStyle.Fill; panel.Controls.Add(ctrl1); m_DockingManager.DockControl(ctrl2, this, DockingStyle.Right, 200); m_DockingManager.DockControl(ctrl3, ctrl2, DockingStyle.Tabbed, 200); m_DockingManager.DockControl(ctrl4, ctrl2, DockingStyle.Tabbed, 200); m_DockingManager.DockControl(ctrl5, this, DockingStyle.Bottom, 200); m_DockingManager.SetDockLabel(ctrl2, "ctrl2"); m_DockingManager.SetDockLabel(ctrl3, "ctrl3"); m_DockingManager.SetDockLabel(ctrl4, "ctrl4"); m_DockingManager.SetDockLabel(ctrl5, "ctrl5"); m_DockingManager.EndInit();

Loader.
Live Chat Icon For mobile
Up arrow icon