You are on page 1of 2

Indicaciones y elementos de la tarea 1 de Visual Basic 1 Indicacin de tarea 1 de visual Basic 1 1. 2. 3. 4. 5. 6.

Crear un proyecto con el nombre de tarea 1 de Basic Crear un formulario que se llamara Reloj El formulario tendr un control que se llama panel. Contendr un Label. Contendr 3 controles textbox. Contendr un control Timer el cual no esta directamente en el formulario sino que ajo del contenido del formulario 7. Un control tipo boton Diseo

Los controles tendrn un nombre definido por el usuario Name del formulario Reloj Name del label1 AMPM Name del textbox1 Horas Name del textbox2 Minutos Name del Textbox3 Segundos Time cambiar propiedad interval 100

Prof: Rosario Medrano

Indicaciones y elementos de la tarea 1 de Visual Basic 1 Text del botn cerrar formulario. Cdigo para los objeto load del formulario y timer

Para introducir la programacin presionar doble click sobre el formulario


Public Class Reloj Private Sub Reloj_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Horas.Text = 12 Minutos.Text = 0 Segundos.Text = 0 AMPM.Text = "AM" Timer1.Interval = 50 Timer1.Enabled = True End Sub

Para introducir la programacin presionar doble click sobre el Timer


Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim h As Integer = Horas.Text Dim m As Integer = Minutos.Text Dim s As Integer = Segundos.Text s += 1 If s > 59 Then s = 0 m += 1 End If If m > 59 Then m = 0 h += 1 End If If h > 12 Then h = 1 End If If h = 12 And m = 0 And s = 0 Then AMPM.Text = IIf(AMPM.Text = "AM", "PM", "AM") End If Horas.Text = h Minutos.Text = m Segundos.Text = s End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Close() End Sub End Class

Prof: Rosario Medrano

You might also like