Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, Do u have an example for me to

Status
Not open for further replies.

fmardani

Programmer
Jul 24, 2003
152
0
0
Hi,
Do u have an example for me to be able to right click a win datagrid and pick up the values in the cells for that row
Thanks
 

Try this out !!!

Private Sub myDataGrid_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles myDataGrid.MouseDown
If e.Button = MouseButtons.Right Then
Dim hit As System.Windows.Forms.DataGrid.HitTestInfo
hit = myDataGrid.HitTest(e.X, e.Y)

Select Case hit.Type
Case Windows.Forms.DataGrid.HitTestType.Cell
'Display the value of right clicked cell
MessageBox.Show(myDataGrid.Item(hit.Row, hit.Column))
End Select
End If
End Sub

Tweak the code as per your requirement.

Email: pankajmsm@yahoo.com
 
Thanks for the example, PankajBanga.
But I would like to right click the row and then get all the values in the cells for that row.
Your example only shows the value for a particular cell.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top