Datagrid - double click row to fire event

jonathen

Member
Joined
May 12, 2005
Messages
17
Programming Experience
1-3
Hi Guys,

I have been trying to find an answer to this one and can't seem to find it, although there must be a way of doing this...

I have a Windows Form I created in VS.NET which I want to be able to double click on any cell in any row and fire an event. Currently, if I double click on the (what's it called?) auto column with the black arrow in it, it fires the event for that row. But if I double click any column in a row, it either makes it editable or does nothing (dependant on what I tell it to do).

How can I make it so that when I double click a column, it highlights the whole row and fires my event?

Any help will be greatly appreciated as I am pulling my hair out!

Thanks in advance,

Jon
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,322
Location
Sydney, Australia
Programming Experience
10+
I think this will work:
VB.NET:
	Private Sub DataGrid1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.DoubleClick
		Me.DataGrid1.Select(Me.DataGrid1.CurrentRowIndex)
	End Sub
 
Top Bottom