Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/02/2012, 14:26
Avatar de CarmenRocio
CarmenRocio
 
Fecha de Ingreso: junio-2010
Ubicación: Perú - Lima - Chorrillos
Mensajes: 116
Antigüedad: 14 años, 9 meses
Puntos: 8
Información Respuesta: Cambiar la longitud de una fila de una datagridview en vb.net

Hola foros gracias a mi amigo Aquaventus pude solucionar mi problema allí les dejo el código este lo llamo desde el EditingControlShowing

Código vb:
Ver original
  1. Private Sub Validar_Keypress8(ByVal sender As Object, ByVal e As KeyPressEventArgs)
  2.         Try
  3.             Dim columna As Integer = dgvDocumento.CurrentCell.ColumnIndex
  4.             If columna = 2 Then
  5.                 If ColumnTipoCompr.Equals("01") Then
  6.                     'Si la longitud es 8
  7.                    If DirectCast(sender, TextBox).Text.Length = 8 Then
  8.                         'Habilitamos el borrar
  9.                        If Char.IsControl(e.KeyChar) Then
  10.                             'Permitimos borrar
  11.                            e.Handled = False
  12.                         Else
  13.                             'Evitamos que se ingresen más
  14.                            e.Handled = True
  15.                         End If
  16.                     Else
  17.                         If Char.IsDigit(e.KeyChar) Then
  18.                             e.Handled = False
  19.                         ElseIf Char.IsControl(e.KeyChar) Then
  20.                             e.Handled = False
  21.                         Else
  22.                             e.Handled = True
  23.                         End If
  24.                     End If
  25.  
  26.                 End If
  27.             End If
  28.         Catch ex As Exception
  29.             MessageBox.Show(ex.Message, "TÍTULO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
  30.         End Try
  31.     End Sub
__________________
Juan 3:16: “Porque tanto amó Dios al mundo, que dio a su Hijo unigénito, para que todo el que cree en él no se pierda, sino que tenga vida eterna

Te dice : Carmen Rocio G. G.