Solved

Selecting from DataGridView with right click

Posted on 2009-07-16
2
294 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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…

867 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

21 Experts available now in Live!

Get 1:1 Help Now