Visual Basic.NET - validacion de cajas de texto

 
Vista:
Imágen de perfil de kike
Val: 26
Ha mantenido su posición en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

validacion de cajas de texto

Publicado por kike (29 intervenciones) el 15/11/2016 18:42:32
Buenas a todos: Tengo 2 cajas de texto

tipo:
codigo:

VALIDO EL TIPO AL APRETAR ENTER Y PASAR EL FOCO A CODIGO de esta manera

1
2
3
4
5
6
7
8
9
10
11
Private Sub txtTipo_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTipo.KeyPress
    If Asc(e.KeyChar) = 13 Then
        If Me.txtTipo.Text = "" Or txtTipo.Text <> "I" And txtTipo.Text <> "E" Then
            MsgBox("Falta Ingresar Tipo de Cuenta.... I= ingresos, E= egresos ", MsgBoxStyle.Information, " ERROR")
            Exit Sub
        End If
        txtCodigo.Focus()
    Else
         e.KeyChar = UCase(e.KeyChar)
    End If
End Sub

AHORA SI NO APRIETO EL ENTER Y ME POSICIONO EN CODIGO CON EL MOUSE LO VALIDO de esta manera

1
2
3
4
5
6
7
Private Sub txtCodigo_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtCodigo.GotFocus
    If Me.txtTipo.Text = "" Or txtTipo.Text <> "I" And txtTipo.Text <> "E" Then
        MsgBox("Falta Ingresar Tipo de Cuenta.... I= ingresos, E= egresos ", MsgBoxStyle.Information, " ERROR")
        Exit Sub
    End If
    txtTipo.Focus()
End Sub

Lo Valida pero entra en Loop mostrandome el error.... en VB6 funcionaba ok.

Agradecería enormemente su ayuda para solucionar este problema
MIL GRACIAS
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