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.

NullReferenceException from BarManager

Thread ID:

Created:

Updated:

Platform:

Replies:

37197 Nov 17,2005 05:04 AM Aug 4,2006 04:31 PM Windows Forms 9
loading
Tags: Tools
Andy Wu
Asked On November 17, 2005 05:04 AM

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 10:06 AM

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 04:03 AM

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 11:32 AM

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 01:21 PM

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

Leow Kah Man
Replied On August 1, 2006 11:37 PM

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 02:51 PM

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?

Thanks,
Mano

MenuSample1.zip

Leow Kah Man
Replied On August 2, 2006 09:40 PM

Hi,

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 06:27 AM

Version 4.202.0.37

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

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.

Regards,
Mano

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.

;