COLEGIO “HUMBERTO MATA MARTÍNEZ” PROGRAMACIÓN
TEMA: PROGRAMAS REALIZADOS EN VISUAL BASIC NOMBRE: JESSICA LEMA CURSO: 5° “B” LICENCIADO: RODRIGO MULLO
CALCULADORA
Public Class Form1 Dim DATO As Double Dim DATO2 As Double Dim RESUL As Double Dim OPE As Double Dim PUN As Double Private Sub BT17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT17.Click TextBox1.Clear() BT2.Enabled = True End Sub Private Sub BT1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT1.Click TextBox1.Text = TextBox1.Text & "0" End Sub Private Sub BT2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT2.Clickz TextBox1.Text = TextBox1.Text & "." PUN = 1 If PUN = 1 Then BT2.Enabled = False
End If End Sub Private Sub BT5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT5.Click TextBox1.Text = TextBox1.Text & "1" End Sub Private Sub BT6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT6.Click TextBox1.Text = TextBox1.Text & "2" End Sub Private Sub BT7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT7.Click TextBox1.Text = TextBox1.Text & "3" End Sub Private Sub BT9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT9.Click TextBox1.Text = TextBox1.Text & "4" End Sub Private Sub BT10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT10.Click TextBox1.Text = TextBox1.Text & "5" End Sub Private Sub BT11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT11.Click TextBox1.Text = TextBox1.Text & "6" End Sub Private Sub BT13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT13.Click TextBox1.Text = TextBox1.Text & "7" End Sub Private Sub BT14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT14.Click TextBox1.Text = TextBox1.Text & "8" End Sub Private Sub BT15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT15.Click TextBox1.Text = TextBox1.Text & "9" End Sub Private Sub BT16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT16.Click OPE = 1 DATO = Val(TextBox1.Text) TextBox1.Clear() BT2.Enabled = True End Sub
Private Sub BT3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT3.Click DATO2 = Val(TextBox1.Text) If OPE = 1 Then RESUL = DATO + DATO2 TextBox1.Text = RESUL BT2.Enabled = True Else If OPE = 2 Then RESUL = DATO - DATO2 TextBox1.Text = RESUL BT2.Enabled = True Else If OPE = 3 Then RESUL = DATO * DATO2 TextBox1.Text = RESUL BT2.Enabled = True Else If OPE = 4 Then RESUL = DATO / DATO2 TextBox1.Text = RESUL BT2.Enabled = True End If End If End If End If End Sub Private Sub BT12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT12.Click OPE = 2 DATO = Val(TextBox1.Text) TextBox1.Text = “” BT2.Enabled = True End Sub Private Sub BT8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT8.Click OPE = 3 DATO = Val(TextBox1.Text) TextBox1.Text = “” BT2.Enabled = True End Sub Private Sub BT4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT4.Click OPE = 4 DATO = Val(TextBox1.Text) TextBox1. Text = “” BT2.Enabled = True End Sub End Class
OPERACIONES
Public Class Form1 Dim Text3 As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox3.Text = Val(TextBox2.Text) + Val(TextBox1.Text) End Sub Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox3.Text = Val(TextBox2.Text) - Val(TextBox1.Text) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox3.Text = Val(TextBox2.Text) * Val(TextBox1.Text) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox3.Text = Val(TextBox2.Text) / Val(TextBox1.Text) End Sub End Class
CALIFICACIONES
Public Class Form1 Dim n1 As Double Dim n2 As Double Dim n3 As Double Dim n4 As Double Dim resul As Double Dim pro As Double Dim div As Double Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged n1 = Val(TextBox1.Text) If n1 > 10 Then Textbox.text=("error nota mayor a 10") End If End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged n2 = Val(TextBox2.Text) If n2 > 10 Then Textbox.text= ("error nota mayor a 10") End If End Sub Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
n3 = Val(TextBox3.Text) If n3 > 10 Then Textbox.text =("error nota mayor a 10") End If End Sub Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged n4 = Val(TextBox4.Text) If n4 > 10 Then Textbox.text =("error nota mayor a 10") End If End Sub Private Sub BT5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT5.Click TextBox5.Text = TextBox5.Text TextBox5.Text = (n1 + n2 + n3 + n4) End Sub Private Sub BT6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT6.Click div = 4 TextBox6.Text = (n1 + n2 + n3 + n4) / div resul = (n1 + n2 + n3 + n4) / div End Sub Private Sub BT7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT7.Click If resul = 10 Then TextBox7.Text = " supera los aprendizajes requeridos" Else If resul >= 8 Then TextBox7.Text = "domina los aprendizajes requeridos " Else If resul = 7 Then TextBox7.Text = "alcansa los aprendizajes requeridos " Else If resul >= 5 Then TextBox7.Text = "proximo los aprendizajes requeridos " Else If resul <= 4 Then TextBox7.Text = "no alcansa los aprendizajes requeridos " End If End If End If End If End If End Sub End Clas
HORAS A MINUTOS Y SEGUNDOS
Public Class Form1 Dim CV Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click CV = Val(TextBox1.Text) TextBox2.Text = CV * 60 TextBox3.Text = CV * 1300 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.text= “” TextBox2. text= “” TextBox3. text= “” End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
TRANSFORMACION DOLAR
Public Class Form1 Dim dl As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click dl = Val(TextBox1.Text) TextBox2.Text = dl * 0.7829 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.text = “” TextBox2.text= “” End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
DIAS A HORAS MINUTOS Y SEGUNDOS
Public Class Form1 Dim CV As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click CV = Val(TextBox1.Text) TextBox2.Text = CV * 24 TextBox3.Text = CV * 1440 TextBox4.Text = CV * 86400 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1. text= “” TextBox2. text= “” TextBox3. text= “” TextBox4. text= “” End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
DIE ZMONEDAS DIFERENTES
Public Class Form1 Dim dl As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click dl = Val(TextBox10.Text) TextBox1.Text = dl * 12.4341 TextBox2.Text = dl * 95.4315 TextBox3.Text = dl * 9.19181 TextBox4.Text = dl * 1.49826 TextBox5.Text = dl * 79.0 TextBox6.Text = dl * 5.088 TextBox7.Text = dl * 0.960728 TextBox8.Text = dl * 6.90964 TextBox9.Text = dl * 6.78615 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1. text= “” TextBox2. text= “” TextBox3. text= “” TextBox4. text= “” TextBox5. text= “” TextBox6. text= “” TextBox7. text= “” TextBox8. text= “” TextBox9. text= “” TextBox10. text= “” End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub
AREA Y PERIMETRO DEL RECTANGULO
Public Class Form1 Dim B As Double Dim A As Double Dim l1 As Double Dim l2 As Double Dim l3 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click B = Val(TextBox1.Text) A = Val(TextBox2.Text) l1 = Val(TextBox3.Text) l2 = Val(TextBox4.Text) l3 = Val(TextBox5.Text) TextBox6.Text = (B * A) / 2 TextBox7.Text = l1 + l2 + l3 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1. Text= “” TextBox2. text= “” TextBox3. text= “” TextBox4. text= “” TextBox5. text= “” TextBox6. text= “” TextBox7. text= “”
End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
AREA Y PERIMETRO DE LA CIRCUNFERENCIA
Public Class Form1 Dim PI As Double Dim Rd As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click PI = 3.1415 Rd = Val(TextBox1.Text) TextBox2.Text = PI * (Rd * Rd) TextBox3.Text = 2 * (PI * Rd) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.text= “” TextBox2. text= “” TextBox3. text= “” End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
AREA DEL TRIANGULO
Public Class Form1 Dim B As Double Dim A As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click B = Val(TextBox1.Text) A = Val(TextBox2.Text) TextBox3.Text = (A * B) / 2 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1. text= “” TextBox2. text= “” TextBox3. text= “” End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End class
PERIMETRO Y AREA DEL CUADRADO
Public Class Form1 Dim L1 As Double Dim L2 As Double Dim L3 As Double Dim L4 As Double Dim B As Double Dim A As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click L1 = Val(TextBox1.Text) L2 = Val(TextBox2.Text) L3 = Val(TextBox3.Text) L4 = Val(TextBox4.Text) TextBox5.Text = L1 + L2 + L3 + L4 B = Val(TextBox7.Text) A = Val(TextBox8.Text) TextBox6.Text = B * A End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" TextBox8.Text = "" End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles End sub End class
AREA Y PERIMETRO DEL ROMBO
ublic Class Form1 Dim DM As Double Dim Ds As Double Dim l1 As Double Dim l2 As Double Dim l3 As Double Dim l4 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click DM = Val(TextBox1.Text) Ds = Val(TextBox2.Text) l1 = Val(TextBox3.Text) l2 = Val(TextBox4.Text) l3 = Val(TextBox5.Text) l4 = Val(TextBox6.Text) TextBox7.Text = (DM * Ds) / 2 TextBox8.Text = l1 + l2 + l3 + l4 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1. text= “” TextBox2. text= “” TextBox3. text= “” TextBox4. text= “” TextBox5. text= “” TextBox6. text= “” TextBox7. text= “” TextBox8. text= “” End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub
End Class
AREA Y PERIMETRO DEL RECTANGULO
Public Class Form1 Dim L1 As Double Dim L2 As Double Dim L3 As Double Dim L4 As Double Dim B As Double Dim A As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click L1 = Val(TextBox1.Text) L2 = Val(TextBox2.Text) L3 = Val(TextBox3.Text) L4 = Val(TextBox4.Text) TextBox5.Text = L1 + L2 + L3 + L4 B = Val(TextBox7.Text) A = Val(TextBox8.Text) TextBox6.Text = B * A End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" TextBox8.Text = "" End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End
End Sub End Class
FACTURA
Public Class Form1 Dim CT As Double Dim CT1 As Double Dim CT2 As Double Dim CT3 As Double Dim CT4 As Double Dim VU As Double Dim VU1 As Double Dim VU2 As Double Dim VU3 As Double Dim VU4 As Double Dim Vt As Double Dim Vt1 As Double Dim Vt2 As Double Dim Vt3 As Double Dim Vt4 As Double Dim R As Double Dim v2 As Double Dim v3 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click CT = Val(TextBox1.Text) CT1 = Val(TextBox2.Text)
CT2 = Val(TextBox3.Text) CT3 = Val(TextBox4.Text) CT4 = Val(TextBox5.Text) VU = Val(TextBox11.Text) VU1 = Val(TextBox12.Text) VU2 = Val(TextBox13.Text) VU3 = Val(TextBox14.Text) VU4 = Val(TextBox15.Text) TextBox16.Text = CT * VU TextBox17.Text = CT1 * VU1 TextBox18.Text = CT2 * VU2 TextBox19.Text = CT3 * VU3 TextBox20.Text = CT4 * VU4 Vt = Val(TextBox16.Text) Vt1 = Val(TextBox17.Text) Vt2 = Val(TextBox18.Text) Vt3 = Val(TextBox19.Text) Vt4 = Val(TextBox20.Text) TextBox21.Text = Vt + Vt1 + Vt3 + Vt4 If (TextBox21.Text > 10000) Then TextBox22.Text = (TextBox21.Text * 100) / 25 MsgBox("DESCUENTO DE 25%") Else If (TextBox21.Text > 5000 & TextBox21.Text < 10000) Then TextBox22.Text = (TextBox21.Text * 100) / 20 MsgBox("DESCUENTO DE 20%") Else If (TextBox21.Text >= 2500 & TextBox21.Text < 5000) Then TextBox22.Text = (TextBox21.Text * 100) / 15 MsgBox("DESCUENTO DE 15%") Else If (TextBox21.Text >= 1200 & TextBox21.Text < 2500) Then TextBox22.Text = (TextBox21.Text * 100) / 10 MsgBox("DESCUENTO DE 10%") Else If (TextBox21.Text >= 350 & TextBox21.Text < 1200) Then TextBox22.Text = (TextBox21.Text * 100) / 5 MsgBox("DESCUENTO DE 5%") Else If (TextBox21.Text < 350) Then TextBox22.Text = 0.0 MsgBox("NO EXISTE DESCUENTO") End If End If End If End If End If
End If TextBox23.Text = TextBox21.Text - TextBox22.Text R = TextBox21.Text * 0.1 v2 = Val(TextBox22.Text) v3 = Val(TextBox24.Text) TextBox24.Text = TextBox21.Text - R TextBox25.Text = (TextBox21.Text - v2) + v3 End Sub End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
NUMERO PAR E IMPAR
Public Class Form1 Dim residuo As Double Dim i As Double Dim r As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click r = Val(TextBox1.Text) residuo = r Mod 2 If residuo = 1 Then
TextBox2.Text = (r & " ES IMPAR ") Else TextBox2.Text = (r & " ES PAR ") End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1. text= “” TextBox2. text= “” End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
NÚMERO POSITIVO Y NEGATIVO
Public Class Form1 Dim R As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click R = Val(TextBox1.Text) If (R > 0) Then TextBox2.Text = "POSITIVO" End If If (R < 0) Then TextBox2.Text = "NEGATIVO" End If
End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1. text= “” TextBox2. text= “” End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
TABLAS DE MULTIPLICAR
Public Class Form1 Dim TB As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TB = Val(TextBox37.Text) TextBox13.Text = TB TextBox14.Text = TB TextBox15.Text = TB TextBox16.Text = TB TextBox17.Text = TB
TextBox18.Text = TB TextBox19.Text = TB TextBox20.Text = TB TextBox21.Text = TB TextBox22.Text = TB TextBox23.Text = TB TextBox24.Text = TB TextBox25.Text = TB * TextBox1.Text TextBox26.Text = TB * TextBox2.Text TextBox27.Text = TB * TextBox3.Text TextBox28.Text = TB * TextBox4.Text TextBox29.Text = TB * TextBox5.Text TextBox30.Text = TB * TextBox6.Text TextBox31.Text = TB * TextBox7.Text TextBox32.Text = TB * TextBox8.Text TextBox33.Text = TB * TextBox9.Text TextBox34.Text = TB * TextBox10.Text TextBox35.Text = TB * TextBox11.Text TextBox36.Text = TB * TextBox12.Text End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class