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

NullReferenceException from BarManager

Thread ID:





37197 Nov 17,2005 10:04 AM UTC Aug 4,2006 08:31 PM UTC WinForms 9
Tags: Tools
Andy Wu
Asked On November 17, 2005 10:04 AM UTC

Has anybody ever met this exception? Any ideas of how to solve it? Thanks in advance. The detail message is as below: System.NullReferenceException: A BarItem (Text: ) that is not part of a BarManager is found in the menus or toolbars. Make sure to add the BarItem to a BarManager before adding it to the menus or toolbars. at Syncfusion.Windows.Forms.Tools.XPMenus.MainFrameBarManager.RefreshContainer(IBarItemContainer container) at Syncfusion.Windows.Forms.Tools.XPMenus.MainFrameBarManager.UpdateBarsInManager(BarManager manager) at Syncfusion.Windows.Forms.Tools.XPMenus.MainFrameBarManager.UpdateBars() at Syncfusion.Windows.Forms.Tools.XPMenus.MainFrameBarManager.OnFormActivated(Form form) at Syncfusion.Windows.Forms.Tools.XPMenus.MainFrameBarManager.FormActivated(Object sender, EventArgs e) at System.Windows.Forms.Form.OnActivated(EventArgs e) at System.Windows.Forms.Form.set_Active(Boolean value) at System.Windows.Forms.Form.WmActivate(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Mano J [Syncfusion]
Replied On November 17, 2005 03:06 PM UTC

Hi Andy, After looking into the exception, I have found that one of the barItem in your coding with no text is not added to MainFrameBarManager.Items collection. Please make sure that all the parentBarItems or BarItems that are created has to be added to MainFrameBarManager before adding into menus. this.MainFrameBarManager1.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPMenus.BarItem[] { this.barItem1, this.barItem2, this.parentBarItem1, this.parentBarItem2, this.barItem3}); Please let me know if you have any questions. Regards, Mano

Andy Wu
Replied On November 18, 2005 09:03 AM UTC

The problem doesm''t occur often. Mostly, our project is okey. Even if this happens, it disappears after several trys to run our project. Any ideas on why this happens?

Mano J [Syncfusion]
Replied On November 18, 2005 04:32 PM UTC

Hi Andy, Are you creating menus through code or through designer? Also let me know the version of Essential studio you are working and .Net Framework version. Regards, Mano

Administrator [Syncfusion]
Replied On November 18, 2005 06:21 PM UTC

Mano, Please check my post in the General forum. Regards, thomas

Leow Kah Man
Replied On August 2, 2006 03:37 AM UTC

I have an MDI parent with MainFrameBarManager.
I have a child form (call it Form1) with ChildFrameBarManager.
I have a child form (call it Form2) with ChildFrameBarManager.

1. When I''m in a Form1, I right click on it, a popup menu appears.

2. This popup menu has a BarItem with a shortcut key of Control+M.
The same BarItem also appears in the MDI parent (due to merging of menus between the parent MDI and child MDI forms)

3. When I click on this BarItem using mouse, Form2 appears, no problems. This is correct.

4. Now repeat step 1, then press Control+M

5. I get the same exception as described above.

Before you jump to a quick conclusion on this problem, note that I could open Form2 if I use mouse but not if I use Control+M

Mano J [Syncfusion]
Replied On August 2, 2006 06:51 PM UTC

Hi Leow,

I could not reproduce this exception in my test sample. Could you please test this sample in your side and let me know if you are able to reproduce the problem, else please

Also, please let me know the Essential Studio version you are using?



Leow Kah Man
Replied On August 3, 2006 01:40 AM UTC


Thanks for preparing the initial sample.

For the time being, I do not have much time to add-on to your sample to demonstrate the problem.
I would have to insert some toolbars, icons, virtual GridControl, TabBarSplitterControl, etc.
This is because the popup menu appears on right clicking on the virtual GridControl cells.

When I do or when I managed to identify the culprit of the problem, I shall let you know without delay.

The workaround that I am using at the moment is to Disable the form that is showing the popup menu prior to loading another MDI child form.

Leow Kah Man
Replied On August 4, 2006 10:27 AM UTC


Mano J [Syncfusion]
Replied On August 4, 2006 08:31 PM UTC

Hi Leow,

We are currently working on this issue as we are still unable to reproduce it in our subsystems. I will update you soon with more details.

Thanks for your patience.



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

This page will automatically be redirected to the 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