Capturing Control Keys (Arrow Movement) within the DataGrid

I've seen a bunch of examples here on how to capture the KeyPress and KeyDown events within a datagrid to capture arrow movement within a datagrid, but there's been so many varying options, that I am now thouroughly confused.  I have a very simple requirement that I have spent hours trying to solve, to no avail.  The following is what I have/need:

I have a read only data grid that displays a list of items in 3-5 columns.  I am only using the data grid to list items so that when a user clicks a row, another action fires in my application.  In other words, no editing, adding or deleting... only clicking and sorting.  This works very well with the default datagrid options, but I need two things to happen which I can't seem to control.  The first, is that I don't want the user to "enter" a cell.  Instead, when they click a cell, the entire row is simply highlighted, and it does not appear as though the user can edit the text in the cell.  Even setting the datagrid to read-only doesn't prevent this.  The second requirement is that when the user clicks the right or left arrow keys, no action is taken within the datagrid (e.g. cell or row shifting), but a message box appears saying "You clicked the left arrow key" (obviously, there is more to it than this, but this should get me there).  Finally, I need the up/down arrow keys to function as they do now and select the previous and next records, but again, just highlighting the row, not entering the individual cell.  Can anyone provide me an example of this.   I would think it should be easy.  Any help is apprecitated!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This may only help with the keypress part of your question, not the entering cell part of your question

  Private Sub DataGrid1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGrid1.KeyUp
        Select Case e.KeyCode
            Case Keys.Up : MsgBox("Up Arrow Pressed")
            Case Keys.Right : MsgBox("Right Arrow Pressed")
            Case Keys.Down : MsgBox("Down Arrow Pressed")
            Case Keys.Left : MsgBox("Left Arrow PRessed")
        End Select
    End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bmcclearyAuthor Commented:
Thanks for the response, but unfortunately, the key up event for the data grid doesn't work, because the text box within the datagridcolumn is the control that raises the event, not the entire data grid.  I tried your exampe and the arrow key clicks are not captured or raised.  I was hoping it was going to be that easy, but unfortunately, it is not.
  This isn't exactly right, but it may help you get going...

Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
        If DataGrid1.CurrentCell.ColumnNumber = (iOldCol + 1) Then
            MsgBox("RightArrow Pressed")
            DataGrid1.CurrentCell = New DataGridCell(iOldCol - 1, iOldRow)
        End If
        If DataGrid1.CurrentCell.ColumnNumber = (iOldCol - 1) Then
            MsgBox("LeftArrow Pressed")
            DataGrid1.CurrentCell = New DataGridCell(iOldCol + 1, iOldRow)
        End If

        If DataGrid1.CurrentCell.RowNumber = (iOldRow + 1) Then
            MsgBox("DownArrow Pressed")
            DataGrid1.CurrentCell = New DataGridCell(iOldCol, iOldRow - 1)
        End If
        If DataGrid1.CurrentCell.RowNumber = (iOldRow - 1) Then
            MsgBox("UpArrow Pressed")
            DataGrid1.CurrentCell = New DataGridCell(iOldCol, iOldRow + 1)
        End If

        iOldCol = DataGrid1.CurrentCell.ColumnNumber
        iOldRow = DataGrid1.CurrentCell.RowNumber
    End Sub
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.