Manual de Visual Basic Principiante

 

  Lección: 8

 

Capítulo: Ejercicio 6: Alarma

 

 

Crea un formulario con tres etiquetas, dos cajas de texto, dos botones, un reloj con intervalo de 1000 y escribe el siguiente código:

 

El botón Establecer la Alarma y Minimizar

 

Private Sub Command1_Click()

 

Form1.WindowState = 1

 

Timer1.Enabled = True

 

End Sub

 

El botón Salir

 

Private Sub Command2_Click()

 

Unload Me

 

End

 

End Sub

 

El reloj

 

Private Sub Timer1_Timer()

 

Dim horas As String

 

hora = Format(Time, "hh:mm")

 

If hora = Text1.Text Then

 

Beep

 

MsgBox Text2.Text, vbOKOnly + vbInformation, "Aviso de la Alarma"

 

Timer1.Enabled = False

 

Form1.WindowState = 0

 

End If

 

End Sub

 

   Volver al índice!