Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Selecting from DataGridView with right click

Posted on 2009-07-16
2
Medium Priority
?
303 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 280 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
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…
Screencast - Getting to Know the Pipeline

824 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