Curso: 11B - 11C
Fecha: Junio 7 de 2013
Asignatura: Tecnología e Informática.
Formación en Valor: Lealtad.
Núcleo Integrador: Eventos Lostfocus y Gotfocus.
Objetivo: Programar la ubicación del Mouse.
Este evento ocurre cuando el cursor sale de un objeto(Cuadro de Texto, Botón de comando, etc.)
Evento Gotfocus
Este evento ocurre cuando el cursor Entra o Cae en un objeto(Cuadro de Texto, Botón de comando, etc.)
Diseñe la siguiente pantalla:
Copie este código en la ventana de código del programa y ejecute el programa con F5
Private Sub Command1_Click()
If Val(Text2) <= 1200000 Then
Text3 = 70000
Else
Text3 = 0
End If
Text4 = Val(Text2) + Val(Text3)
Command2.SetFocus
End Sub
Private Sub Command1_GotFocus()
If Text3 <> "" Then
MsgBox "No debe escribir el transporte este se calcula"
Text3 = ""
End If
If Text4 <> "" Then
MsgBox "No debe escribir El Total a Pagar este se calcula"
Text4 = ""
End If
If Text2 = "" Then
MsgBox "Debe escribir el Salario"
Text2.SetFocus
End If
End Sub
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text1.SetFocus
End Sub
Private Sub Text2_GotFocus()
If Text1 = "" Then
MsgBox "Debe escribir el nombre"
Text1.SetFocus
End If
End Sub
Private Sub Text3_GotFocus()
If Text2 = "" Then
MsgBox "Debe escribir el Salario"
Text2.SetFocus
End If
End Sub
Taller:
Teniendo en cuenta el programa anterior, desarrolle usted uno que utilice el evento Gotfocus.
No hay comentarios:
Publicar un comentario