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

Adding Menu Items in code

Thread ID:





4980 Jun 12,2003 12:09 PM UTC Jun 16,2003 10:23 AM UTC WinForms 1
Tags: Tools
Asked On June 12, 2003 12:09 PM UTC

Hi There, I'm trying to add menu to my main form and am having no luck! Seems like I'm missing a step, but what? int catId = mainMenuManager.Categories.Add("xxxx"); ParentBarItem menuBar = new ParentBarItem(); menuBar.CategoryIndex = catId; menuBar.ID = "zzzz"; menuBar.Text = "test"; mainMenuManager.Items.Add(menuBar); mainMenu.Items.Add(menuBar);

Ramesh Praveen [Syncfusion]
Replied On June 16, 2003 10:23 AM UTC

Hi, A ParentBarItem represents a dropdown submenu (please refer to our User's Guide in Tools\Docs\User's Guide folder) which itself needs to be added to a Bar instance. So, you will have to also do this: Bar mainMenuBar = new Bar(); mainMenuBar.BarStyle = BarStyle.IsMainMenu|...; mainMenuBar.Text = '..."; // This will add an empty main menu bar to your form mainMenuManager.Bars.Add(mainMenuBar); // Then create a new instance of a ParentBarItem as in the code above and add it to your mainMenuBar. mainMenuBar.Items.Add(parentBarItem); Regards, Praveen


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

Live Chat Icon For mobile
Live Chat Icon