Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7678451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:39:03+00:00 2026-05-31T17:39:03+00:00

I am using a context menu for my gridcontrol. theGrid.ContextMenuStrip = contextMenuStrip1; This has

  • 0

I am using a context menu for my gridcontrol.

theGrid.ContextMenuStrip = contextMenuStrip1;
This has add, delete, edit as the choices. 

How can I create a menu class and use for the choices in the contextmenustrip.
Can anyone show me some sample code to do this.

Thanks
Sun

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:39:04+00:00Added an answer on May 31, 2026 at 5:39 pm

    MSDN has information on how to add items to a contextmenustrip

    Sample Code:

    // Declare the ContextMenuStrip control.
        private ContextMenuStrip fruitContextMenuStrip;
    
        public Form3()
        {
            // Create a new ContextMenuStrip control.
            fruitContextMenuStrip = new ContextMenuStrip();
    
            // Attach an event handler for the 
            // ContextMenuStrip control's Opening event.
            fruitContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(cms_Opening);
    
            // Create a new ToolStrip control.
            ToolStrip ts = new ToolStrip();
    
            // Create a ToolStripDropDownButton control and add it
            // to the ToolStrip control's Items collections.
            ToolStripDropDownButton fruitToolStripDropDownButton = new ToolStripDropDownButton("Fruit", null, null, "Fruit");
            ts.Items.Add(fruitToolStripDropDownButton);
    
            // Dock the ToolStrip control to the top of the form.
            ts.Dock = DockStyle.Top;
    
            // Assign the ContextMenuStrip control as the 
            // ToolStripDropDownButton control's DropDown menu.
            fruitToolStripDropDownButton.DropDown = fruitContextMenuStrip;
    
            // Create a new MenuStrip control and add a ToolStripMenuItem.
            MenuStrip ms = new MenuStrip();
            ToolStripMenuItem fruitToolStripMenuItem = new ToolStripMenuItem("Fruit", null, null, "Fruit");
            ms.Items.Add(fruitToolStripMenuItem);
    
            // Dock the MenuStrip control to the top of the form.
            ms.Dock = DockStyle.Top;
    
            // Assign the MenuStrip control as the 
            // ToolStripMenuItem's DropDown menu.
            fruitToolStripMenuItem.DropDown = fruitContextMenuStrip;
    
            // Assign the ContextMenuStrip to the form's 
            // ContextMenuStrip property.
            this.ContextMenuStrip = fruitContextMenuStrip;
    
            // Add the ToolStrip control to the Controls collection.
            this.Controls.Add(ts);
    
            //Add a button to the form and assign its ContextMenuStrip.
            Button b = new Button();
            b.Location = new System.Drawing.Point(60, 60);
            this.Controls.Add(b);
            b.ContextMenuStrip = fruitContextMenuStrip;
    
            // Add the MenuStrip control last.
            // This is important for correct placement in the z-order.
            this.Controls.Add(ms);
        }
    

    Or another link to ContextMenuStrip in C#

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that you can use the context menu using a right-mouse-click in a
Suppose I am using a context menu to add child nodes to a treeview
I'm using Dynamic Drive's jQuery Context Menu script and I can get the context
When using CodeRush/Refactor Pro, I can use my mouse to toggle a context menu
I am using this jQuery context popup menu extension: http://www.trendskitchens.co.nz/jquery/contextmenu/ This context menu is
In my soundboard app I have created a context menu using this code. public
so I'm using the following context menu: (function($) { $.fn.setUpContextMenu = function() { $(this).dialog({
I have a listview with two columns and I'm using a context menu to
I am using XML file for creating Context Menu for my ListView. (Please see
I'm trying to do this: using(var context = new SampleEntities()) { User user =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.