Buscar este blog

martes, 11 de febrero de 2014

Examen Final - Programacion Visual - VB.NET 2012 - 2013

Ingresar elementos numéricos a una lista y calcular la suma de ellos.
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles btnAgregar.Click
Dim NUM As Double
NUM = txtNumero.Text
lstLista.Items.Add(NUM)
txtNumero.Focus()
txtNumero.SelectAll()
End Sub

Private Sub btnSuma_Click(sender As System.Object, e As System.EventArgs) Handles btnSuma.Click
Dim S As Double
For X As Integer = 0 To lstLista.Items.Count - 1
S = S + lstLista.Items(X)
Next
Label2.Text = S
End Sub

Programa el control timer para poder mover en una trayectoria cuadrada la imagen (derecha, abajo, izquierda, arriba……)

Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Dim X As Integer
For X = 30 To Me.Width - 80
Me.PictureBox1.Left = X
System.Threading.Thread.Sleep(30)
Next

For X = 30 To Me.Height - 150
Me.PictureBox1.Top = X
System.Threading.Thread.Sleep(30)
Next

For X = Width - 70 To 50 Step -1
Me.PictureBox1.Left = X
System.Threading.Thread.Sleep(30)
Next

For X = Height - 150 To 30 Step -1
Me.PictureBox1.Top = X
System.Threading.Thread.Sleep(30)
Next
Timer1.Enabled = False
End Sub

Private Sub Programa2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = False
Timer1.Interval = 100
End Sub

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub

No hay comentarios:

Publicar un comentario