Help with Controling ENTER KEY inside a DataGrid

I have a datagrid that shows a list of customers.  Currently I have some code in the double click event of the data grid that fires when they double click on the row header.  I first would like to be able to use my arrow keys to move up and down on the grid to the row the user wants.  This already works except it only highlights the cell they are in.. I would like for it to keep the whole row highlghted at all times.  This grid is never used for updating.. its read only.  Ones the user is on the row they want, i would like them to be able to hit the ENTER KEY that would basicly fire the same code as the DOUBLE CLICK EVENT does?

Any suggestions on this?

Who is Participating?
Hi accmats, well that is a bit more difficult, you have to create your own datagrid (and use that datagrid) and override the ProcessCmdKey, like

Public Class MyDataGrid
          Inherits DataGrid

          Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, keyData As System.Windows.Forms.Keys) As Boolean
               If msg.WParam.ToInt32() = CInt(Keys.Enter) Then
                    Return True
               End If
               Return MyBase.ProcessCmdKey(msg, keyData)
          End Function 'ProcessCmdKey

     End Class
use the currenccellchange event


 Private Sub dg_CurrentCellChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged

    End Sub
accmatsAuthor Commented:
ok... that worked to highlight the rows as I use the down arrow to get to the need row.  Now how can I capture the ENTER KEY and make it do basicly the same code I currently have the DOUBLE CLICK event doing?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.