You are on page 1of 27

E.A.

P UNH
ELECTRÓNICA

PROGRAMAS EN VISUAL BASIC

41. HAER UN PROGRAMA PARA CONVERTIR LAS HORAS Y MINUTOS EN SEGUNDOS Y


ADEMAS QUE SE SUME.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Btn1.Click
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim s As Integer
a = Val(Me.txt0.Text)
b = Val(Me.txt1.Text) c =
Val(Me.txt2.Text) s = a *
3600 + b * 60 + c
Me.txt3.Text = Str(s)

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Close()
End Sub
End Class

42. HCER UN PROGRAMA QUECONVIERTA LA HORA INGRESADA EN MINUTOS Y


TAMBIEN EN SEGNUDOS
Public Class Form1

Private Sub convertir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles convertir.Click txt1.Text =
Val(Me.txt0.Text) * 60

txt2.Text = Val(Me.txt0.Text) * 60 * 60

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
3
0
E.A.P UNH
ELECTRÓNICA

End
End Sub

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btn.Click
txt1.Text = "" txt0.Text =
"" txt2.Text = ""
txt1.Focus()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
LBLR.Text = DateTime.Now.ToLongTimeString()
LBLF.Text = DateTime.Now.ToLongDateString()
End Sub

Private Sub LBLR_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles LBLR.Click

End Sub
End Class

43. HACER UN PRORGAMA QUE INDIQUE LA HORA COMO UNA ALARMA

Public Class Form1

Private MiTimer As New System.Windows.Forms.Timer()

Private Shared Sub TimerEventProcessor(ByVal myObject As Object, ByVal myEventArgs


As EventArgs)

'Este metodo se ejecutara cuando el temporizador arranque cada cinco


segundos
MsgBox("ahora son " & Now)

'Para que suene la alarma tendras que añadir al proyecto un ficheo wav y
para llamarlo solo debes poner
3
1
E.A.P UNH
ELECTRÓNICA

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
'creamos un gestor para el evento Tick
AddHandler MiTimer.Tick, AddressOf TimerEventProcessor
'damos valor a la propiedad para que cada tick se dispare cada 5 segundos
MiTimer.Interval = 5000
'arancamos el control
MiTimer.Start()
End Sub

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles lblcronometro.Click

'creamos un gestor para el evento Tick


AddHandler MiTimer.Tick, AddressOf TimerEventProcessor
'damos valor a la propiedad para que cada tick se dispare cada 5 segundos
MiTimer.Interval = 5000
'arancamos el control
MiTimer.Start()

End Sub

End Class

44. HALLAR LA SUMA DE DOS MATRICES DE 2 POR 2 CON ARREGLOS.


Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim j As Integer
3
2
E.A.P UNH
ELECTRÓNICA

Dim A(1, 1) As Integer


Dim B(1, 1) As Integer
Dim C(1, 1) As Integer

A(0, 0) = Val(Me.txtA00.Text)
A(0, 1) = Val(Me.txtA01.Text)
A(1, 0) = Val(Me.txtA10.Text)
A(1, 1) = Val(Me.txtA11.Text)

B(0, 0) = Val(Me.txtB00.Text)
B(0, 1) = Val(Me.txtB01.Text)
B(1, 0) = Val(Me.txtB10.Text)
B(1, 1) = Val(Me.txtB11.Text)

For i = 0 To 1
For j = 0 To 1
C(i, j) = A(i, j) + B(i, j)
Next
Next

Me.txtC00.Text = C(0, 0)
Me.txtC01.Text = C(0, 1)
Me.txtC10.Text = C(1, 0)
Me.txtC11.Text = C(1, 1)
End Sub
End Class

45. HACER UNA MATRIZ DE 3X2 Y HALLAR LA SUMA DE LOS COLUMNAS DE DICHA
MATRIZ
Public Class Form1

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs)

End Sub

3
3
E.A.P UNH
ELECTRÓNICA

Private Sub btncalcular_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btncalcular.Click
Dim resultado As Integer
Dim resultado2 As Integer
Dim n(3, 2) As Integer

resultado = Val(Me.txt00.Text) + Val(Me.txt10.Text) + Val(Me.txt20.Text)


resultado2 = Val(Me.txt01.Text) + Val(Me.txt11.Text) + Val(Me.txt21.Text)

Me.txtresultado.Text = Str(resultado)
Me.txtresultado2.Text = Str(resultado2)
End Sub

Private Sub txtresultado2_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txtresultado2.TextChanged
End Sub
End Class

46. HACER UNA MATRIZ DE 4x5 Y HALLAR LA SUMA DE LOS COLUMNAS DE DICHA
MATRIZ
Public Class Form1

Private Sub btncalcular_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btncalcular.Click
Dim s0 As Integer
Dim s1 As Integer
Dim s2 As Integer
Dim s3 As Integer
Dim s4 As Integer
Dim n(3, 4) As Integer

s0 = Val(Me.Txt00.Text) + Val(Me.Txt10.Text) + Val(Me.Txt20.Text) +


Val(Me.Txt30.Text)
s1 = Val(Me.Txt01.Text) + Val(Me.Txt11.Text) + Val(Me.Txt21.Text) +
Val(Me.Txt31.Text)
s2 = Val(Me.Txt02.Text) + Val(Me.Txt12.Text) + Val(Me.Txt22.Text) +
Val(Me.Txt32.Text)
s3 = Val(Me.Txt03.Text) + Val(Me.Txt13.Text) + Val(Me.Txt23.Text) +
Val(Me.Txt33.Text)
3
4
E.A.P UNH
ELECTRÓNICA

s4 = Val(Me.Txt04.Text) + Val(Me.Txt14.Text) + Val(Me.Txt24.Text) +


Val(Me.Txt34.Text)

Me.Txts0.Text = Str(s0)
Me.Txts1.Text = Str(s1)
Me.Txts2.Text = Str(s2)
Me.Txts3.Text = Str(s3)
Me.Txts4.Text = Str(s4)

n(0, 0) =
Val(Me.Txt00.Text)

End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs)

End Sub
End Class

47. HACER UN PROGRAMA DONDE SE PUEDA INGRESAR DOS NUMEROS Y SE PUEDA


HALLAR LA SUMA Y RESTA ENTRE ELLOS.
Public Class Form1

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt1.TextChanged

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
txt3.Text = Val(Me.txt1.Text) + Val(Me.txt2.Text)
End Sub

3
5
E.A.P UNH
ELECTRÓNICA

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
txt3.Text = Val(Me.txt1.Text) - Val(Me.txt2.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 Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
Me.txt1.Text = ""
Me.txt2.Text = ""
Me.txt3.Text = ""

End Sub
End Class

48. HACER UN PROGRAMA DONDE INGRESANDO DOS NUMEROS SE PUEDA HALLAR


LA SUMA, MULTIPLICACION Y RESTA ENTRE ELLOS.
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
txt3.Text = Val(Me.txt1.Text) + Val(Me.txt2.Text)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
txt3.Text = Val(Me.txt1.Text) - Val(Me.txt2.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 Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
Me.txt1.Text = ""
Me.txt2.Text = ""
Me.txt3.Text = ""
3
6
E.A.P UNH
ELECTRÓNICA

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button5.Click
txt3.Text = Val(Me.txt1.Text) * Val(Me.txt2.Text)
End Sub
End Class

49. HACER UN PROGRAMA QUE TRATA DE SER UN RELOJ .


Public Class Form1

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
LBLRELOJ.Text = DateTime.Now.ToLongTimeString()
End Sub

Private Sub LBLRELOJ_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles LBLRELOJ.Click

End Sub
End Class

50. HACER UN PROGRAMA PARA HALAR LA TAZA DE CAMIO DE DOLARES A SOLES Y


VICEVERSA.
Public Class Form1
Dim a As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As

3
7
E.A.P UNH
ELECTRÓNICA

System.EventArgs) Handles Button1.Click


a = txtdinero.Text
If chkcompra.Checked = True Then
TextBox2.Text = a / 2.78
TextBox2.Text = FormatCurrency(TextBox2.Text)
LBL1.Text = "ud a cambiado a dolares"
End If
If chkventa.Checked = True Then
TextBox2.Text = a * 2.8
TextBox2.Text = FormatCurrency(TextBox2.Text)
LBL1.Text = "ud a cambiado a soles"
End If
End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles chkcompra.CheckedChanged

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
txtdinero.Text = ""
TextBox2.Text = ""
chkcompra.Checked = False
chkventa.Checked = False
txtdinero.Focus()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
Me.Close()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
lbleloj.Text = DateTime.Now.ToLongTimeString()
End Sub
End Class

3
8
E.A.P UNH
ELECTRÓNICA

51. HACER UN PROGRAMA DONDE SE INGRESA SUS DATOS Y SU EDAD PARA


SABER SI ES MAYOR DE EDAD.
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox1.Focus()

End Sub

9
E.A.P UNH
ELECTRÓNICA

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
If Val(TextBox2.Text) >= 18 Then
TextBox3.Text = "tu eres mayor de edad"
Else
TextBox3.Text = "tu eres menor de edad"
End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
Me.Close()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
LBLRELOJ.Text = DateTime.Now.ToLongTimeString()
End Sub
End Class

52. HACER UN PROGRAMA DONDE SE PUEDA SABER EL AUMENTO DE PAGO DE UN


TRABAJADOR

Public Class Form1

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
If Val(txt2.Text) Then
txt3.Text = Val(txt2.Text) * 0.12
Else
If Val(txt2.Text) Then

txt3.Text = 0.9 * Val(txt2.Text)


Else
txt3.Text = 0.8 * Val(txt2.Text)

End If
4
0
E.A.P UNH
ELECTRÓNICA

End If
txt4.Text = Val(txt2.Text) + Val(txt3.Text)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
txt1.Text = "" txt2.Text = ""
txt3.Text = "" txt4.Text = ""
txt1.Focus()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
End
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
LBLRELOJ.Text = DateTime.Now.ToLongTimeString()

End Sub
End Class

53. HACER UN PROGRAMA DONDE SE INGRESE DATOS Y SE PUEDAMODIFICAR COMO


SUBRAYARLO, NEGRREARLO, O CONVERTIRLO A LETRA CURSIVA.
Public Class Form1

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles RadioButton1.CheckedChanged
txtN.Font = New Font(txtN.Font, FontStyle.Bold)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


4
1
E.A.P UNH
ELECTRÓNICA

System.EventArgs) Handles Button1.Click


End
End
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles RadioButton2.CheckedChanged txtN.Font = New
Font(txtN.Font, FontStyle.Italic)
End Sub

Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles RadioButton6.CheckedChanged txtN.Font = New
Font(txtN.Font, FontStyle.Underline)
End Sub

Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles RadioButton5.CheckedChanged
txtN.Text = LCase(txtN.Text)

End Sub

Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles RadioButton4.CheckedChanged
txtN.ForeColor = Color.Red
End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles RadioButton3.CheckedChanged
txtN.BackColor = Color.Fuchsia

End Sub

Private Sub RadioButton7_CheckedChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles RadioButton7.CheckedChanged
txtN.Text = UCase(txtN.Text)

End Sub
End Class

54. HACER UN PROGRAMA DONDE INGRESANDO DOS NUMEROS SE PUEDA HALLAR


LA SUMA, MULTIPLICACION, DIVIDIR Y RESTAR ENTRE ELLOS.
4
2
E.A.P UNH
ELECTRÓNICA

Public Class Form1


Dim A As Integer

Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Label2.Click

End Sub

Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txtS.TextChanged

End Sub

Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Label4.Click

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
txt1.Text = "" txt2.Text = ""
txtS.Text = "" txtR.Text = ""
txtM.Text = "" txtD.Text = ""
txt1.Focus()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
Me.Close()

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
txtS.Text = Val(Me.txt1.Text) + Val(Me.txt2.Text)
txtR.Text = Val(Me.txt1.Text) - Val(Me.txt2.Text) txtM.Text
= Val(Me.txt1.Text) * Val(Me.txt2.Text) txtD.Text =
Val(Me.txt1.Text) / Val(Me.txt2.Text)

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick lblR.Text =
DateTime.Now.ToLongTimeString() LBLF.Text =
DateTime.Now.ToLongDateString()
End Sub
End Class

4
3
E.A.P UNH
ELECTRÓNICA

55. HACER UN PROGRAMA DONDE SE PUEDA INGRESAR LA CANTIDAD DE


ARTEFACTOS VENTIDOS, SU PRECIO Y EL PRODUCTO ADEMAS ES UNA OPCION EN
DESCUENTO DEL 10 %.
Public Class Form1
Dim producto, precio, cantidad, monto, descuento, r As Single
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
txt1.Text = "" txt2.Text = ""
txt3.Text = "" txt4.Text = ""
txt5.Text = "" txt6.Text = ""
txt1.Focus()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
precio = txt2.Text cantidad =
txt3.Text monto = precio * cantidad
If CheckBox1.Checked = True Then
descuento = 0.1 * monto Else
descuento = 0
End If
precio = monto - descuento
txt4.Text = monto txt5.Text
= descuento txt6.Text =
precio

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
r = MsgBox("desea cerrar esta ventana", MsgBoxStyle.YesNo)
If r = 6 Then
End

End If
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
4
4
E.A.P UNH
ELECTRÓNICA

LBLRELOJ.Text = DateTime.Now.ToLongTimeString()
End Sub
End Class

56. HALLAR SUS DESCUENTOS DE UN PROFESIONAL COMO EL DEL SEGURO,


DEPENDIENDO DE SU ESTADO LABORAL
Public Class Form1
Dim AFP, FON, ESS, SOLID, CUARTA As Single

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles RadioButton1.CheckedChanged
CheckBox1.Checked = True
CheckBox2.Checked = True
CheckBox3.Checked = True
CheckBox4.Checked = False
CheckBox5.Checked = False
AFP = 0.11 * TextBox3.Text
FON = 0.05 * TextBox3.Text
ESS = 0.05 * TextBox3.Text

TextBox4.Text = AFP
TextBox5.Text = FON
TextBox6.Text = ESS
TextBox9.Text = 80

End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles RadioButton2.CheckedChanged
CheckBox1.Checked = True
CheckBox2.Checked = True
CheckBox3.Checked = False
CheckBox4.Checked = False
CheckBox5.Checked = False

AFP = 0.11 * TextBox3.Text


FON = 0.05 * TextBox3.Text
ESS = 0.05 * TextBox3.Text
TextBox4.Text = AFP
TextBox5.Text = FON
4
5
E.A.P UNH
ELECTRÓNICA

TextBox6.Text = ESS
TextBox10.Text = 100

End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles RadioButton3.CheckedChanged
CheckBox1.Checked = True
CheckBox2.Checked = False
CheckBox3.Checked = False
CheckBox4.Checked = False
CheckBox5.Checked = False
AFP = 0.11 * TextBox3.Text
FON = 0.05 * TextBox3.Text
ESS = 0.05 * TextBox3.Text
TextBox4.Text = AFP
TextBox5.Text = FON
TextBox6.Text = ESS
TextBox11.Text = 160

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
TextBox11.Text = ""
TextBox9.Text = ""
RadioButton1.Text = False

TextBox1.Focus()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Me.Close()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
LBLRELOOJ.Text = DateTime.Now.ToLongTimeString()
End Sub
End Class

4
6
E.A.P UNH
ELECTRÓNICA

57. HACER UN PROGRAMA DONDE SE PUEDA HALLAR EL ÁREA DE UN CIRCULO Y A LA


VEZ EL PEROMETRO DE DICHO CIRCUNFERENCIA.
Public Class Form1

Private Sub But_calcular_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_calcular.Click
Dim radio As Single
Dim perimetro As Single
Dim area As Single
Const pi = 3.14 radio =
Text_radio.Text area = radio
* radio * pi perimetro = 2
* pi * radio Text_area.Text
= area
Text_perimetro.Text = perimetro
End Sub

Private Sub But_nuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_nuevo.Click
Text_radio.Text = ""
Text_area.Text = ""
Text_perimetro.Text = ""
Text_perimetro.SendToBack()
End Sub

Private Sub But_salir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_salir.Click
End
End Sub
End Class

58. REALIZAR UN PROGRAMA DONDE SE PUEDA CALCULAR EL TIPO DE CAMBIO DE


MONEDA ENTRE EL DÓLAR Y EL NUEVO SOL, INGRESANDO EL TIPO DE CAMBIO.
Public Class Form1

Private Sub But_calcular_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_calcular.Click
Dim tipcam As Single
4
7
E.A.P UNH
ELECTRÓNICA

Dim numsol As Single


Dim numdol As Long tipcam
= Text_cambio.Text numdol
= Text_dolares.Text numsol
= (numdol * tipcam)
Text_soles.Text = "s/" +
Str(numsol)
End Sub

Private Sub But_nuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_nuevo.Click
Text_cambio.Text = ""
Text_dolares.Text = ""
Text_soles.Text = ""
Text_cambio.SendToBack()
End Sub

Private Sub But_salir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_salir.Click
End
End Sub
End Class

59. HACER UN PRORGAMA DONDE SE PUEDA HALLAR LA DIVISION,


MULTIPLICACION, RESTA Y SUMA DE DOS NUMEROS PERO SOLO SE PUEDE VER
LA RESPUESTA DE UNA OPERACIÓN QUE SERA ELEGIDA.
Public Class Form1

Private Sub But_suma_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_suma.Click
Dim numero1 As Single
Dim numero2 As Single
Dim respuesta As Single numero1
= Text_numero1.Text numero2 =
Text_numero2.Text respuesta =
numero1 + numero2
Text_operacion.Text = "la operacion elegida es suma"
Text_resultado.Text = respuesta

End Sub

Private Sub But_resta_Click(ByVal sender As System.Object, ByVal e As


4
8
E.A.P UNH
ELECTRÓNICA

System.EventArgs) Handles But_resta.Click


Dim numero1 As Single
Dim numero2 As Single
Dim respuesta As Single
numero1 = Text_numero1.Text
numero2 = Text_numero2.Text
respuesta = numero1 - numero2
Text_operacion.Text = "la operacion elegida es una resta"
Text_resultado.Text = respuesta
End Sub

Private Sub But_multiplicacion_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_multiplicacion.Click
Dim numero1 As Single
Dim numero2 As Single
Dim respuesta As Single numero1
= Text_numero1.Text numero2 =
Text_numero2.Text respuesta =
numero1 * numero2
Text_operacion.Text = "la operacion elegida es una multiplicacion"
Text_resultado.Text = respuesta
End Sub

Private Sub But_division_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_division.Click
Dim numero1 As Single
Dim numero2 As Single
Dim respuesta As Single numero1
= Text_numero1.Text numero2 =
Text_numero2.Text respuesta =
numero1 / numero2
Text_operacion.Text = "la operacion elegida es una division"
Text_resultado.Text = respuesta
End Sub

Private Sub But_nuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_nuevo.Click
Text_numero1.Text = ""
Text_numero2.Text = ""
Text_operacion.Text = ""
Text_resultado.Text = ""
Text_numero1.SendToBack()

End Sub

Private Sub But_salir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_salir.Click
End
End Sub

4
9
E.A.P UNH
ELECTRÓNICA

60. HACER UN PROGRAMA DONDE SE PUEDA HALLAR EL AREA DE UN CUADRADO Y


TAMBIEN EL PERIMETRO DE DICHO CUADRADO INTRODUCIENDO EL LADO Y
ADEMAS SE PUEDA LIMPIAR.
Public Class Form1

Private Sub But_calcular_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_calcular.Click
Dim lado As Integer
Dim peri As Integer
Dim area As Integer lado
= Text_lado.Text peri
= 4 * lado area = lado
^ 2
Text_perimetro.Text = peri
Text_area.Text = area
End Sub

Private Sub But_nuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_nuevo.Click
Text_lado.Text = ""
Text_perimetro.Text = ""
Text_area.Text = ""
Text_lado.SendToBack()
End Sub

Private Sub But_salir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_salir.Click
End
End Sub

5
E.A.P UNH
ELECTRÓNICA

End Class

61. HALLAR EL AREA Y EL PERIMETRO DE UN RECTANGULO Y ADEMAS INGRESAR


UN COMANDO PARA LIMPIAR LO ESCRITO.
Public Class Form1

Private Sub But_calcular_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_calcular.Click
Dim base As Integer
Dim altura As Integer
Dim primetro As Integer
Dim area As Integer base =
Text_base.Text altura =
Text_altura.Text primetro = 2
* (base + altura) area = base
* altura Text_perimetro.Text =
primetro
Text_area.Text = area

End Sub

Private Sub But_nuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_nuevo.Click
Text_base.Text = ""
Text_altura.Text = ""
Text_perimetro.Text = ""
Text_area.Text = ""
Text_base.SendToBack()
End Sub

Private Sub But_salir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_salir.Click
End
End Sub
End Class

51
E.A.P UNH
ELECTRÓNICA

62. HALLAR EL PAGO DE UN TROBAJADOR SABIENDO SU JORNAL Y LOS DIAS QUE


TRABAJA.
Public Class Form1

Private Sub But_calcular_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_calcular.Click
Dim jornal As String
Dim diastrabajados As Integer
Dim sueldo As Single jornal =
Text_jornal.Text
diastrabajados = Text_diastrabajados.Text
sueldo = jornal * diastrabajados
Text_sueldo.Text = "S/." + Str(sueldo)
End Sub

Private Sub But_nuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_nuevo.Click
Text_jornal.Text = ""
Text_diastrabajados.Text = ""
Text_sueldo.Text = ""
Text_jornal.SendToBack()
End Sub

Private Sub But_salir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles But_salir.Click
End
End Sub
End Class

5
E.A.P UNH
ELECTRÓNICA
E.A.P UNH
ELECTRÓNICA
63. HACER UN PROGRAMA QUE INRGESANDO 4 NUMEROS SE PUEDA
HALLAR LA SUMA DE ELLOS.
Public Class Form1

Private Sub Buttonaceptar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnaceptar.Click
Dim n1 As Integer
Dim n2 As Integer
Dim n3 As Integer
Dim n4 As
Integer Dim suma
As Integer n1 =
Val(Me.txtn1.Text)
n2 = Val(Me.txtn2.Text)
n3 = Val(Me.txtn3.Text)
n4 = Val(Me.txtn4.Text)
suma = (n1 + n2 + n3 +
n4)

Me.txtn5.Text = Str(suma)

End Sub

End Class

64. HACER UN PROGRAMA QUE DADO TRES NUMROS HALLE EL MAYOR DE ELLOS
E.A.P UNH
ELECTRÓNICA
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim n1 As Integer
Dim n2 As Integer Dim n3, mayor As Integer n1 =
Val(Me.txtn1.Text) n2 = Val(Me.txtn2.Text) n3 = Val(Me.txtn3.Text)
If n1 > n2 Then If n1 > n3 Then mayor = n1 Else
mayor = n3
End If
Else
If n2 > n3 Then mayor = n2 Else
mayor = n3
End If
End If
Me.txtresultado.Text = Str(mayor)

End Sub
End Class

65. HACER UN PROGRAMA PARA SABER EL ESTADO DE NOTA QUE TIENE UN


ESTUDIANTE.
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim p As
Integer Dim
c As String
p =
Val(Me.txtp.Text)

If p >= 0 And p
<= 5 Then c
= "muy malo"
Else
End If
If p >= 6 And p <= 10 Then
c = "malo"
E.A.P UNH
ELECTRÓNICA
Else
End If
If p >= 11 And p <= 14 Then c = "regular"
Else
End If
If p >= 15 And p <= 17 Then c = "bueno"
Else
End If
If p >= 18 And p <= 20 Then c = "muy bueno" End If
Me.txtc.Text = c

End Sub
End Class

You might also like