VISUAL STUDIO 2013 PROYECTOS PARA TRABAJAR CON LOS ALUMNOS ----------------------------------------------------------------------- Lic. Ernesto Rubén Rodríguez Alvarado ----------------------------------------------------------------------PROYECTO 1. Usuario y Contraseña 2016 Código: Public Class Form2 Private Sub CmdIngresar_Click(sender As Object, e As EventArgs) Handles --------------------------------------------CmdIngresar.Click If TUsuario.Text = "Rodriguez" And TContraseña.Text = "1234" Then MsgBox("¿Deseas pasar al control del sistema 2016?") Form3.Show() Else MsgBox("Contraseña Incorrecta... ingresar nuevamente") End If End Sub ---------------------------------------------Private Sub CmdPasar_Click(sender As Object, e As EventArgs) Handles CmdPasar.Click Form3.Show() End Sub End Class ----------------------------------------------------------------------- PROYECTO 2: AREAS DE FIGURAS GEOMETRICAS DEL ESPACIO 1. Diseño: 2. Código Public Class Form1 ----------------------------------------------Private Sub CmdArea_Click(sender As Object, e As EventArgs) Handles CmdArea.Click Dim area, h, r, pi As Single pi = 3.1416 r = Val(TRadio.Text) h = Val(TAltura.Text) area = 2 * pi * r * (h + r) TArea.Text = Str(area) End Sub -----------------------------------------------Private Sub CmdVolumen_Click(sender As Object, e As EventArgs) Handles CmdVolumen.Click Dim volumen, r, h As Single r = Val(TRadio.Text) h = Val(TAltura.Text) volumen = Math.PI * (r * r) * h TxtVolumen.Text = Str(volumen) End Sub --------------------------------------------Private Sub CmdNuevo_Click(sender As Object, e As EventArgs) Handles CmdNuevo.Click TAltura.Text = "" TRadio.Text = "" TxtVolumen.Text = "" TArea.Text = "" End Sub ---------------------------------------------Private Sub CmdPasar_Click(sender As Object, e As EventArgs) Handles CmdPasar.Click Form2.Show() End Sub End Class PROYECTO Nº 3 TEMA: MI CALCULADORA Lic. Rubén Rodríguez Alvarado 1. Diseño: Private Sub Cmd7_Click(sender As Object, e As EventArgs) Handles Cmd7.Click Txt1.Text = Txt1.Text & 7 End Sub --------------------------------------------Private Sub Cmd8_Click(sender As Object, e As EventArgs) Handles Cmd8.Click Txt1.Text = Txt1.Text & 8 End Sub --------------------------------------------Private Sub Cmd9_Click(sender As Object, e As EventArgs) Handles Cmd9.Click Txt1.Text = Txt1.Text & 9 End Sub --------------------------------------------Private Sub CmdNuevo_Click(sender As Object, e As EventArgs) Handles CmdNuevo.Click Txt1.Text = "" End Sub --------------------------------------------Private Sub CmdSuma_Click(sender As Object, e As EventArgs) Handles CmdSuma.Click OPE = 1 dato = Val(Txt1.Text) Txt1.Clear() End Sub 2. CÓDIGO Private Sub CmdPotencia_Click(sender As Object, e As EventArgs) Handles CmdPotencia.Click Txt1.Text = Str$(Txt1.Text * Val(Txt1.Text)) End Sub --------------------------------------------Private Sub CmdIgual_Click(sender As Object, e As EventArgs) Handles CmdIgual.Click dato1 = Val(Txt1.Text) If OPE = 1 Then resultado = dato + dato1 Txt1.Text = resultado Else OPE = 2 resultado = dato - dato1 Txt1.Text = resultado End If End Sub --------------------------------------------- Public Class Form1 Dim dato As Double Dim dato1 As Double Dim resultado As Double Dim OPE As Double --------------------------------------------Private Sub Cmd0_Click(sender As Object, e As EventArgs) Handles Cmd0.Click Txt1.Text = Txt1.Text & 0 End Sub --------------------------------------------Private Sub Cmd1_Click(sender As Object, e As EventArgs) Handles Cmd1.Click Txt1.Text = Txt1.Text & 1 End Sub --------------------------------------------Private Sub Cmd2_Click(sender As Object, e As EventArgs) Handles Cmd2.Click Txt1.Text = Txt1.Text & 2 End Sub --------------------------------------------Private Sub Cmd3_Click(sender As Object, e As EventArgs) Handles Cmd3.Click Txt1.Text = Txt1.Text & 3 End Sub --------------------------------------------Private Sub Cmd4_Click(sender As Object, e As EventArgs) Handles Cmd4.Click Txt1.Text = Txt1.Text & 4 End Sub --------------------------------------------Private Sub Cmd5_Click(sender As Object, e As EventArgs) Handles Cmd5.Click Txt1.Text = Txt1.Text & 5 End Sub --------------------------------------------Private Sub Cmd6_Click(sender As Object, e As EventArgs) Handles Cmd6.Click Txt1.Text = Txt1.Text & 6 End Sub --------------------------------------------- Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Label2.Text = TimeOfDay End Sub --------------------------------------------Private Sub CmdCubica_Click(sender As Object, e As EventArgs) Handles CmdCubica.Click Txt1.Text = Val(Txt1.Text) ^ (1 / 2) End Sub --------------------------------------------Private Sub Resta_Click(sender As Object, e As EventArgs) Handles Resta.Click OPE = 2 dato = Val(Txt1.Text) Txt1.Clear() End Sub --------------------------------------------Private Sub Division_Click(sender As Object, e As EventArgs) Handles Division.Click OPE = 3 dato = Val(Txt1.Text) Txt1.Clear() End Sub End Class --------------------------------------------- 3. EJECUCION PROYECTO Nº TEMA: USO DEL PROGRESSBAR Lic. Rubén Rodríguez Alvarado 1. Diseño: Label Progressbar Timer 2. Código Public Class Form1 Public contador As Integer Private Sub ProgressBar1_Click(sender As Object, e As EventArgs) Handles ProgressBar1.Click ProgressBar1.Value = 0.0 ProgressBar1.Maximum = 100 Timer1.Interval = 40 Timer1.Enabled = True End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick If contador < 100 Then ProgressBar1.Value = contador contador = contador + 1 'Form2.Show() Else Timer1.Enabled = False Form2.Show() Me.Close() End If End Sub End Class 3. Ejecutando Amigos (as) les dejo diseño de aplicaciones en Visual, para que ustedes desarrollen sus código, si no pueden, les estare enviando la próxima semana. PROYECTO Nº 6 TEMA: MOVIMIENTO DE OBJETOS CON EL TECLADO Lic. Rubén Rodríguez Alvarado 1. Diseño: PROYECTO Nº 7 TEMA: MOVIMIENTO DE OBJETOS CON EL TECLADO Lic. Rubén Rodríguez Alvarado Contactos: rurodriguez39@gmail.com Cel. 997316147 (Peru – Lima – Callao)