Edu Grado2(EDVAC)
Cantidad de envíos : 82 Fecha de inscripción : 30/10/2008
| Tema: Ejercicio 4 Dom 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 | |
|
Admin Admin
Cantidad de envíos : 40 Fecha de inscripción : 24/10/2008
| Tema: Prueba esto Dom 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
| |
|
Edu Grado2(EDVAC)
Cantidad de envíos : 82 Fecha de inscripción : 30/10/2008
| Tema: Re: Ejercicio 4 Dom Nov 01, 2009 11:17 pm | |
| Con ese código no me funciona bien Admin. | |
|