
19/03/2009, 06:12
|
| | Fecha de Ingreso: agosto-2005
Mensajes: 33
Antigüedad: 19 años, 6 meses Puntos: 0 | |
Respuesta: Problemas con decimales en datagrid Para eso, seria con esto
Código:
Private Sub DGLineas_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles datagridview1.EditingControlShowing
AddHandler e.Control.KeyPress, AddressOf Validar
End Sub
Sub Validar(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
If datagridview1.Columns(datagridview1.CurrentCellAddress.X).HeaderText = "Campo_Decimal" Then
If e.KeyChar = "." Or e.KeyChar = "," Then
e.KeyChar = ","
ElseIf Not Char.IsNumber(e.KeyChar) Then
e.Handled = True
'MsgBox("Este campo no acepta letras ni simbolos", MsgBoxStyle.Information)
End If
End If
End Sub
|