programacion en visual basic

22
COLEGIO MUNICIPAL HUMBERTO MATA MARTINEZ PROGRAMACION LIC: RODRIGO MULLO PAUL LIGÑA 2do DE BACH TECNICO 2012 – 2013

Upload: paul-ligna

Post on 12-Mar-2016

219 views

Category:

Documents


0 download

DESCRIPTION

es muy secillo para hacer los ejercicos estos son ejemplos para visual basic

TRANSCRIPT

Page 1: programacion en visual basic

COLEGIO MUNICIPAL HUMBERTO MATA MARTINEZ

PROGRAMACION

LIC: RODRIGO MULLO PAUL LIGÑA 2do DE BACH TECNICO

2012 – 2013

Page 2: programacion en visual basic

Introducción:

1. Las calculadora

2. Las 4 operaciones básicas

3. La notas

4. Trasformación de horas minuto y segundos

5. Transformación de días, horas, minutos y

segundos

6. Área de un triangulo

7. Transformar de dólares a euros

8. Trasformar de dólares a mas monedas

9. Área y perímetro del triangulo

10. Circulo

11. Cuadrado

12. Rectángulo

13. rombo

14. par y impar

15. positivo y negativo

16. las tablas de multiplicar

17. factura

18. la prueba

Page 3: programacion en visual basic

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.Click 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

Page 4: programacion en visual basic

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.Clear() 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.Clear() 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.Clear() BT2.Enabled = True End Sub End Class

Page 5: programacion en visual basic

Las 4 operaciones basicas 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

Las notas 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 MsgBox("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 MsgBox("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)

Page 6: programacion en visual basic

If n3 > 10 Then MsgBox("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 MsgBox("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 Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged End Sub Private Sub BT2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub BT3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub BT4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged End Sub

Page 7: programacion en visual basic

Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged End Sub Private Sub BT1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class

Trasformación de horas

minuto y segundos Private Sub cal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cal.Click COMBER = Val(TextBox1.Text) TextBox2.Text = COMBER * 60 TextBox3.Text = COMBER * 3600 End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub Private Sub l1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles l1.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged COMBER = Val(TextBox1.Text) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class

Page 8: programacion en visual basic

Transformación de

Días, horas, minutos

Y segundos

Public Class Form1 Dim COMBER As Double Private Sub cal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cal.Click COMBER = Val(TextBox4.Text) TextBox1.Text = COMBER * 24 TextBox2.Text = COMBER * 1440 TextBox3.Text = COMBER * 86400 End Sub Private Sub l1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles l1.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click End Sub End Class

Page 9: programacion en visual basic

Área de un triangulo

Public Class Form1 Dim BAS As Double Dim ALT As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = Val(TextBox2.Text) TextBox3.Text = (BAS * ALT) / 2 End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class

Transformar de dólares

a euros

Public Class Form1 Dim COMBER As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click COMBER = Val(TextBox1.Text) TextBox2.Text = COMBER * 0.772778 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End

Page 10: programacion en visual basic

End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class

Trasformar de dólares a

más monedas Public Class Form1 Dim COMBER As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click COMBER = Val(TextBox1.Text) TextBox2.Text = COMBER * 0.772778 TextBox3.Text = COMBER * 12.4659 TextBox4.Text = COMBER * 95.8985 TextBox5.Text = COMBER * 1.50201 TextBox6.Text = COMBER * 10.5674 TextBox7.Text = COMBER * 6.95974 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class

Page 11: programacion en visual basic

Área y perímetro del

triangulo Public Class Form1 Dim BAS As Double Dim ALT As Double Dim per1 As Double Dim per2 As Double Dim per3 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = Val(TextBox2.Text) per1 = Val(TextBox4.Text) per2 = Val(TextBox5.Text) per3 = Val(TextBox6.Text) TextBox3.Text = (BAS * ALT) / 2 TextBox7.Text = per1 + per2 + per3 End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class

Page 12: programacion en visual basic

Cuadrado Public Class Form1 Dim BAS As Double Dim ALT As Double Dim per1 As Double Dim per2 As Double Dim per3 As Double Dim per4 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = Val(TextBox2.Text) per1 = Val(TextBox4.Text) per2 = Val(TextBox5.Text) per3 = Val(TextBox6.Text) per4 = Val(TextBox8.Text) TextBox3.Text = (BAS * ALT) TextBox7.Text = per1 + per2 + per3 + per4 End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() TextBox8.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class

Page 13: programacion en visual basic

Rectángulo Public Class Form1 Dim BAS As Double Dim ALT As Double Dim per1 As Double Dim per2 As Double Dim per3 As Double Dim per4 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = Val(TextBox2.Text) per1 = Val(TextBox4.Text) per2 = Val(TextBox5.Text) per3 = Val(TextBox6.Text) per4 = Val(TextBox8.Text) TextBox3.Text = (BAS * ALT) TextBox7.Text = per1 + per2 + per3 + per4 End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() TextBox8.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class

Page 14: programacion en visual basic

Rombo Public Class Form1 Dim BAS As Double Dim ALT As Double Dim per1 As Double Dim per2 As Double Dim per3 As Double Dim per4 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = Val(TextBox2.Text) per1 = Val(TextBox4.Text) per2 = Val(TextBox5.Text) per3 = Val(TextBox6.Text) per4 = Val(TextBox8.Text) TextBox3.Text = (BAS * ALT) TextBox7.Text = per1 + per2 + per3 + per4 End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() TextBox8.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class

Page 15: programacion en visual basic

Circulo Public Class Form1 Dim BAS As Double Dim ALT As Double Dim per1 As Double Dim per2 As Double Dim per3 As Double Dim per4 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = 3.14159 * 2 TextBox3.Text = (BAS) * (ALT) TextBox7.Text = 2 * ALT * BAS End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox3.Clear() TextBox7.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class

Page 16: programacion en visual basic

Par y impar Public Class Form1 Dim NUM As Double Dim OPER As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click NUM = Val(TextBox1.Text) OPER = NUM Mod 2 If OPER = 1 Then TextBox2.Text = "IMPAR" Else TextBox2.Text = "PAR" End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class

Page 17: programacion en visual basic

Positivo y negativo Public Class Form1 Dim NUM As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click NUM = Val(TextBox1.Text) If NUM <= 0 Then TextBox2.Text = "NEGATIVO" Else TextBox2.Text = "POSITIVO" End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class

Page 18: programacion en visual basic

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 Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox13.Clear() TextBox14.Clear() TextBox15.Clear() TextBox16.Clear() TextBox17.Clear() TextBox18.Clear() TextBox19.Clear() TextBox20.Clear() TextBox21.Clear() TextBox22.Clear() TextBox23.Clear() TextBox24.Clear() TextBox25.Clear() TextBox26.Clear() TextBox27.Clear() TextBox28.Clear() TextBox29.Clear() TextBox30.Clear() TextBox31.Clear() TextBox32.Clear() TextBox33.Clear() TextBox34.Clear() TextBox35.Clear() TextBox37.Clear() TextBox36.Clear() End Sub

Page 19: programacion en visual basic

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 C1 As Double Dim C2 As Double Dim C3 As Double Dim C4 As Double Dim C5 As Double Dim C01 As Double Dim C02 As Double Dim C03 As Double Dim C04 As Double Dim C05 As Double Dim CAN As Double Dim CAN2 As Double Dim CAN3 As Double Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click End Sub Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click C1 = Val(TextBox1.Text) C2 = Val(TextBox2.Text) C3 = Val(TextBox3.Text) C4 = Val(TextBox4.Text) C5 = Val(TextBox5.Text) C01 = Val(TextBox15.Text) C02 = Val(TextBox14.Text) C03 = Val(TextBox13.Text) C04 = Val(TextBox12.Text) C05 = Val(TextBox11.Text) TextBox20.Text = C1 * C01 TextBox19.Text = C2 * C02 TextBox18.Text = C3 * C03 TextBox17.Text = C4 * C04

Page 20: programacion en visual basic

TextBox16.Text = C5 * C05 CAN = C5 * C05 + C4 * C04 + C3 * C03 + C2 * C02 + C1 * C01 CAN2 = C5 * C05 + C4 * C04 + C3 * C03 + C2 * C02 + C1 * C01 TextBox25.Text = CAN If CAN >= 10000 Then MsgBox("DESCUENTO DE 25%") TextBox24.Text = CAN * 0.25 CAN2 = CAN * 0.25 Else If CAN >= 5000 Then MsgBox("DESCUENTO DE 20%") TextBox24.Text = CAN * 0.2 CAN2 = CAN * 0.2 Else If CAN >= 2500 Then MsgBox("DESCUENTO DE 15%") TextBox24.Text = CAN * 0.15 CAN2 = CAN * 0.15 Else If CAN >= 1200 Then MsgBox("DESCUENTO DE 10%") TextBox24.Text = CAN * 0.1 CAN2 = CAN * 0.1 Else If CAN >= 350 Then MsgBox("DESCUENTO DE 5%") TextBox24.Text = CAN * 0.05 CAN2 = CAN * 0.05 Else If CAN < 350 Then MsgBox("SIN DESCUENTO") CAN2 = 0 End If End If End If End If End If End If TextBox23.Text = CAN - CAN2 TextBox22.Text = CAN * 0.12 CAN3 = CAN * 0.12 TextBox21.Text = CAN - CAN2 + CAN3 End Sub Private Sub TextBox24_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox24.TextChanged End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() TextBox8.Clear() TextBox9.Clear() TextBox10.Clear() TextBox11.Clear() TextBox12.Clear() TextBox13.Clear() TextBox14.Clear()

Page 21: programacion en visual basic

TextBox15.Clear() TextBox16.Clear() TextBox17.Clear() TextBox18.Clear() TextBox19.Clear() TextBox20.Clear() TextBox21.Clear() TextBox22.Clear() TextBox23.Clear() TextBox24.Clear() TextBox25.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class

Prueba Public Class Form1 Dim a As Double Dim h As Double Dim base As Double Dim rd As Double Dim pi As Double Dim Bs As Double Dim H2 As Double Dim l1 As Double Dim l2 As Double Dim l3 As Double Dim cb As Double Dim ld As Double Dim ld2 As Double Dim ld3 As Double Dim rd2 As Double Dim h3 As Double Dim hp As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click a = Val(TextBox1.Text) TextBox2.Text = a * a TextBox3.Text = a + a + a + a End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click h = Val(TextBox5.Text) base = Val(TextBox4.Text) TextBox6.Text = base * h TextBox7.Text = (2 * base) + (2 * h) End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click rd = TextBox8.Text pi = 3.1415 TextBox9.Text = pi * (rd * rd) TextBox10.Text = 2 * rd * pi End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

Page 22: programacion en visual basic

Bs = Val(TextBox11.Text) H2 = Val(TextBox12.Text) l1 = TextBox13.Text l2 = TextBox14.Text hp = Math.Sqrt(l1 ^ 2 + l2 ^ 2) TextBox15.Text = (Bs * H2) / 2 TextBox16.Text = l1 + l2 + hp End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click cb = Val(TextBox17.Text) TextBox18.Text = 6 * (cb ^ 2) TextBox19.Text = cb ^ 3 End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click ld = Val(TextBox20.Text) ld2 = Val(TextBox21.Text) ld3 = Val(TextBox22.Text) TextBox23.Text = 2 * (ld * ld2) + 2 * (ld2 * ld3) + 2 * (ld * ld3) TextBox24.Text = ld * ld2 * ld3 End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click h3 = TextBox30.Text rd2 = TextBox25.Text pi = 3.1415 TextBox27.Text = 2 * pi * (rd2 * rd2) TextBox28.Text = 2 * pi * rd2 * h3 TextBox26.Text = 2 * rd2 * pi TextBox29.Text = pi * (rd2 * rd2) * h3 End Sub End Class