Solved

Selecting from DataGridView with right click

Posted on 2009-07-16
2
293 Views
Last Modified: 2013-11-25
Hey guys,

I'm looking for ideas/vb.net code on how to select row(s) from the dataGridView with the right click?

Basically I'm looking for exactly the same functionality as I get with the left click.

Thank you
0
Comment
Question by:Inglorious
2 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 70 total points
ID: 24868842
Somehting like this should work
    Private Sub DataGridView1_CellMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDown

        Me.DataGridView1.ClearSelection()

        Me.DataGridView1(e.ColumnIndex, e.RowIndex).Selected = True

    End Sub

Open in new window

0
 

Author Closing Comment

by:Inglorious
ID: 31604175
Spot on. Thank you!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now