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 6873275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:02:44+00:00 2026-05-27T04:02:44+00:00

When i right click on ultra grid view or may be grid view .

  • 0

When i right click on ultra grid view or may be grid view .
I want to display different contextmenu strip for different columns.
But when i right click i get index of column which i selected not which i right clicked.
How should i get it..
Code is as follows:

 Private Sub DataGridView1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseDown
       If e.Button() = Windows.Forms.MouseButtons.Right Then
            MessageBox.Show(DataGridView1.SelectedCells(0).ColumnIndex.ToString())
        End If
    End Sub
  • 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-27T04:02:45+00:00Added an answer on May 27, 2026 at 4:02 am

    The best way to get UltraColumn under the cursor is to utilize MouseUp event of the UltraGrid class.
    Here is sample in C# but i’m sure you will catch my idea:

    private void Grid_MouseUp(object sender, MouseEventArgs e)
    {
        UltraGrid Grid = sender as UltraGrid;
        if (Grid.DisplayLayout == null)
            return;
        UIElement ue = Grid.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y));
        if (ue == null)
            return;
    
        UIElement mouseupItem = ue;
        UltraGridColumn mouseupColumn = null;
        UltraGridRow mouseupRow = null;
        UltraGridBand mouseupBand = null;
        ColumnHeader mouseupColumnHead = null;
    
        mouseupColumn = (UltraGridColumn)ue.GetContext(typeof(UltraGridColumn), true);
        mouseupRow = (UltraGridRow)ue.GetContext(typeof(UltraGridRow), true);
        mouseupBand = (UltraGridBand)ue.GetContext(typeof(UltraGridBand), true);
        mouseupColumnHead = (ColumnHeader)ue.GetContext(typeof(ColumnHeader), true);
    
        if (mouseupColumnHead != null)
            mouseupColumn = mouseupColumnHead.Column;
    
        if (e.Button == MouseButtons.Right)
        {
            ShowPopupMenu( mouseupColumn );
            return;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to disable right click on the webpage but i want enable right
When you right click on a file and select Compare..., you get a few
I'd expect a right-click-context-menu-style pop-up menu to be a part of jQuery UI. But
I want to create a right click context menu for my textboxes to provide
When I right-click on a resource file in Visual Studio 2008, I get the
When I right-click on my custom UserControl's BackColor property in the property-grid, then click
When I right-click in my class library, I get some quick options to create
I have restricted the right click option in my web page, but in IE
I have a right click popup menu that works fine. I now want to
When I make a right click in a TMemo component the system display a

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.