D.A.I (Trassierra, Córdoba)
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

D.A.I (Trassierra, Córdoba)

D.A.I (Trassierra, Córdoba)
 
ÍndiceÍndice  Últimas imágenesÚltimas imágenes  BuscarBuscar  RegistrarseRegistrarse  ConectarseConectarse  

 

 Ejercicio 4

Ir abajo 
2 participantes
AutorMensaje
Edu
Grado2(EDVAC)
Grado2(EDVAC)
Edu


Cantidad de envíos : 82
Fecha de inscripción : 30/10/2008

Ejercicio 4 Empty
MensajeTema: Ejercicio 4   Ejercicio 4 Icon_minitimeDom Nov 01, 2009 10:36 pm

Código:
Public Class Form1

    Private Sub txtNombre_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtNombre.KeyDown
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{TAB}")
        End If
    End Sub

    Private Sub txtNombre_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNombre.KeyPress
        txtNombre.MaxLength = 30
        If (Char.IsLetter(e.KeyChar)) Then
            e.Handled = False
        ElseIf (Char.IsControl(e.KeyChar)) Then
            e.Handled = False
        Else
            e.Handled = True
        End If
    End Sub

    Private Sub txtApellidos_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtApellidos.KeyDown
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{TAB}")
        End If
    End Sub

    Private Sub txtApellidos_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtApellidos.KeyPress
        txtApellidos.MaxLength = 50
        If (Char.IsLetter(e.KeyChar)) Then
            e.Handled = False
        ElseIf (Char.IsControl(e.KeyChar)) Then
            e.Handled = False
        Else
            e.Handled = True
        End If
    End Sub

    Private Sub txtTelefono_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtTelefono.KeyDown
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{TAB}")
        End If
    End Sub

    Private Sub txtTelefono_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTelefono.KeyPress
        txtTelefono.MaxLength = 9
        If (IsNumeric(e.KeyChar)) Then
            e.Handled = False
        ElseIf (Char.IsControl(e.KeyChar)) Then
            e.Handled = False
        Else
            e.Handled = True
        End If
    End Sub

    Private Sub txtCodigo_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtCodigo.KeyDown
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{TAB}")
        End If
    End Sub

    Private Sub txtCodigo_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCodigo.KeyPress
        txtCodigo.MaxLength = 5
        If (IsNumeric(e.KeyChar)) Then
            e.Handled = False
        ElseIf (Char.IsControl(e.KeyChar)) Then
            e.Handled = False
        Else
            e.Handled = True
        End If
    End Sub

    Private Sub txtDNI_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtDNI.KeyDown
        If (e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Tab) And (txtDNI.Text.Length = 9 Or txtDNI.Text.Length = 0) Then
            SendKeys.Send("{TAB}")
        End If
    End Sub

    Private Sub txtDNI_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtDNI.KeyPress
        txtDNI.MaxLength = 9
        If (txtDNI.Text.Length < 8) Then
            If (IsNumeric(e.KeyChar)) Then
                e.Handled = False
            ElseIf (Char.IsControl(e.KeyChar)) Then
                e.Handled = False
            Else
                e.Handled = True
            End If
        Else
            If (IsNumeric(e.KeyChar)) Then
                e.Handled = True
                txtDNI.CharacterCasing = CharacterCasing.Upper
            Else
                e.Handled = False
            End If
        End If
    End Sub

    Private Sub txtEdad_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtEdad.KeyDown
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{TAB}")
        End If
    End Sub

    Private Sub txtEdad_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEdad.KeyPress
        txtEdad.MaxLength = 3
        If (IsNumeric(e.KeyChar)) Then
            e.Handled = False
        ElseIf (Char.IsControl(e.KeyChar)) Then
            e.Handled = False
        Else
            e.Handled = True
        End If
    End Sub

    Private Sub txtEdad_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtEdad.KeyUp
        If (Val(txtEdad.Text) > 120) Then
            MessageBox.Show("El límite de edad está en 120 años", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            txtEdad.Text = ""
        End If
    End Sub

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        If (MessageBox.Show("¿Estás seguro que deseas salir?", "Advertencia", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.No) Then
            e.Cancel = True
        End If
    End Sub

    Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSalir.Click
        Close()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

End Class
Volver arriba Ir abajo
Admin
Admin
Admin



Cantidad de envíos : 40
Fecha de inscripción : 24/10/2008

Ejercicio 4 Empty
MensajeTema: Prueba esto   Ejercicio 4 Icon_minitimeDom Nov 01, 2009 11:06 pm

Código:

Private Sub txtDNI_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtDNI.KeyPress
        txtDNI.MaxLength = 9
        If (txtdni.Text.Length < 8) Then
            If (Not Char.IsDigit(e.KeyChar) And Not Char.IsControl(e.KeyChar)) Then
                e.Handled = True
            End If
        ElseIf (Not Char.IsLetter(e.KeyChar) And Not Char.IsControl(e.KeyChar)) Then
            e.Handled = True
        End If
    End Sub
Volver arriba Ir abajo
https://daitrassierra.foroes.org
Edu
Grado2(EDVAC)
Grado2(EDVAC)
Edu


Cantidad de envíos : 82
Fecha de inscripción : 30/10/2008

Ejercicio 4 Empty
MensajeTema: Re: Ejercicio 4   Ejercicio 4 Icon_minitimeDom Nov 01, 2009 11:17 pm

Con ese código no me funciona bien Admin.
Volver arriba Ir abajo
Contenido patrocinado





Ejercicio 4 Empty
MensajeTema: Re: Ejercicio 4   Ejercicio 4 Icon_minitime

Volver arriba Ir abajo
 
Ejercicio 4
Volver arriba 
Página 1 de 1.
 Temas similares
-
» Ejercicio nº 15 en C.
» Ejercicio 15, por admin
» Resolución ejercicio Ley D´Hont
» Relacion de ejercicios de PMUL
» Ejercicio tipo C++

Permisos de este foro:No puedes responder a temas en este foro.
D.A.I (Trassierra, Córdoba) :: VISUAL BASIC-
Cambiar a:  
Ante la inminente, lenta, cercana e inexorable finalización de su vida útil. Propongo la plataforma: !Salvemos al foro! Salvando el foro estás contribuyendo en la lucha del cambio climático, en la reproducción del lince ibérico, salvas la amazonia y con cada visita estás alimentando a un pobre informático:

!Por un foro DAI para nuestros hijos!
Le quedan 20 dias al foro, !actúa!

Get your own Chat Box! Go Large!
Situación actual en cordoba aeropuerto

Free counter and web stats
Crear foro | ©phpBB | Foro gratis de asistencia | Denunciar un abuso | ForoActivo.com