Beruflich Dokumente
Kultur Dokumente
El MSGBOX es una ventana que nos muestra un mensaje en el centro de la pantalla. Su sintaxis es la siguiente:
MsgBox(Mensaje, Tipo de Mensaje, Titulo) Por ejemplo: MsgBox("Desea Salir de la Aplicacin?", MsgBoxStyle.YesNo, "Sistemaor) El mensaje que nos mostrara ser el siguiente:
En la presente se muestra una pequea tabla de cdigo ASCII que son las mas usadas.
De A a la Z = del 65 al 90 De la a la z = del 97 al 122 = 255, = 233, = 237, = 243, ? = 250, = 241, = 209 De 0 al 9 = del 48 al 57 ENTER = 13 BACKSPACE = 8 ESC = 27 Barra Espaciadora = 32
Function minuscula(ByVal v As Integer) As Boolean If v >= 97 And v <= 122 Then minuscula = True Else minuscula = False End If End Function
Function numero(ByVal v As Integer) As Boolean If v < 48 And v > 57 Then numero = False Else numero = True End If End Function
Function especial(ByVal v As Integer) As Boolean If v = 13 Or v = 32 Or v = 8 Or v = 255 Or v = 233 Or v = 237 Or v = 243 Or v = 250 Or v = 241 Or v = 209 Then especial = True Else especial = False End If End Function
Sub ingresados() If Trim(Me.txtapenom.Text) <> "" And IsDate(Me.txtfec.Text) And Trim(Me.txttur.Text) <> "" And Trim(Me.txtpro.Text) <> "" Then Me.btnnuevo.Enabled = True Me.btnsalir.Enabled = True Else Me.btnnuevo.Enabled = False Me.btnsalir.Enabled = False End If End Sub
Sub limpiar() Me.txtapenom.Text = "" Me.txtfec.Text = "" Me.txtpro.Text = "" Me.txttur.Text = "" Me.btnnuevo.Enabled = False Me.btnsalir.Enabled = False Me.txtapenom.Focus() End Sub
En el evento keypress de textbox de nombres y apellidos Static anteriorespacio As Boolean If Asc(e.KeyChar) = 13 Then Me.txtfec.Focus() End If If Asc(e.KeyChar) = 32 Then anteriorespacio = True Else If mayuscula(Asc(e.KeyChar)) Or minuscula(Asc(e.KeyChar)) Or especial(Asc(e.KeyChar)) Then If Trim(Me.txtapenom.Text) = "" Or anteriorespacio Then REM convierte a mayuscula e.KeyChar = UCase(e.KeyChar) Else REM convierte a minustcula e.KeyChar = LCase(e.KeyChar) End If anteriorespacio = False Else MsgBox("Debe de Ingresar solo letras", MsgBoxStyle.Information, "Cuidado") e.KeyChar = ChrW(0) Me.btnnuevo.Enabled = False Me.btnsalir.Enabled = False End If End If
If IsDate(Me.txtfec.Text) Then ingresados() Else MsgBox("Debe de ingresar una fecha correcta", MsgBoxStyle.Information, "Cuidado") Me.txtfec.SelectionStart = 0 Me.txtfec.SelectionLength = Len(Me.txtfec.Text) Me.txtfec.Text = Me.txtfec.Text Me.txtfec.Focus() End If
Dim letra As String If Asc(e.KeyChar) = 13 Then Me.txtpro.Focus() Else letra = UCase(e.KeyChar) If letra = "M" Or letra = "T" Or letra = "N" Or Asc(e.KeyChar) = 8 Then REM convierte la letra a mayuscula e.KeyChar = UCase(e.KeyChar) Else MsgBox("Solo debe de ingresar las letras M,T o N", MsgBoxStyle.Information, "Error") REM ignora el caracter ingresado e.KeyChar = ChrW(0) Me.btnnuevo.Enabled = False Me.btnsalir.Enabled = False End If
End If
Private Sub txtpro_KeyPress If numero(Asc(e.KeyChar)) Or Asc(e.KeyChar) = 8 Or Asc(e.KeyChar) = 13 Then ingresados() Else MsgBox("Debe de Ingresar solo numeros", MsgBoxStyle.Information, "Cuidado") e.KeyChar = ChrW(0) Me.btnnuevo.Enabled = False Me.btnsalir.Enabled = False End If Private Sub txtpro_TextChanged If Val(Me.txtpro.Text) < 0 Or Val(Me.txtpro.Text) > 20 Then MsgBox("El Valor Debe Estar Entre 0 y 20", MsgBoxStyle.Information, "Error") Me.txtpro.SelectionStart = 0 Me.txtpro.SelectionLength = Len(Me.txtpro.Text) Me.txtpro.Text = Me.txtpro.SelectedText Me.txtpro.Focus() Me.btnnuevo.Enabled = False Me.btnsalir.Enabled = False Else ingresados() End If
Private Sub txtapenom_TextChanged Ingresados() Private Sub btnnuevo_Click Limpiar() Private Sub txttur_TextChanged Ingresados()
INPUTBOX
El INPUTBOX es una ventana que permite que el usuario pueda ingresar un dato. Su sintaxis es la siguiente:
InputBox(Mensaje, Titulo, Valor Pred., Columna, Fila)
* Mensaje Es el mensaje que se desea mostrar cuando se pida el dato a ingresar. * Titulo Es el titulo de la ventana. * Valor Predeterminado Es el valor que se muestra en forma automtica para ser ingresado. * Columna Es un valor que indica la posicin horizontal del formulario, donde se desea que se muestre la ventana. * Fila Es un valor que indica la posicin vertical del formulario, donde se desea que se muestre la ventana.