Visual Basic.NET - Tecla ENTER en Grid

 
Vista:
sin imagen de perfil

Tecla ENTER en Grid

Publicado por Formula (17 intervenciones) el 31/12/2014 16:58:08
Tengo es te código y, deseo que ese bloque se ejecute solo al momento de presionar la tecla ENTER. He visto muchos ejemplos en linea, pero no me funcionan o no se implementarlos bien.

1
2
3
4
5
6
7
8
Private Sub GridListaEstudiantes_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles GridListaEstudiantes.EditingControlShowing
        Dim h As KeyEventArgs
        If h.KeyData = Keys.Enter Then
            Dim row = GridListaEstudiantes.Rows(GridListaEstudiantes.CurrentRow.Index)
            row.Cells(8).Value = (row.Cells(4).Value + row.Cells(5).Value + row.Cells(6).Value + row.Cells(7).Value) / 4
            SendKeys.Send(Chr(Keys.Tab))
        End If
End Sub

Este codigo me funciona sin la condicion, pues me da un error en la variable h en la linea del IF. Dice que uso una variable antes de darle un valor.

Gracias por su ilustracion.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder