0% found this document useful (0 votes)
42 views3 pages

Ejercicios Visual Basic

This Visual Basic code defines a form with radio buttons, labels, text boxes, and buttons to perform basic mathematical operations. The radio buttons allow selecting an operation: sum, subtraction, multiplication, or division. The text boxes are used to enter the numbers and display the result. The "Calcular" button performs the calculation based on the selected radio button and displays the result. The "Limpiar" button clears the text boxes. The "Salir" button closes the form.

Uploaded by

angelica1225
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views3 pages

Ejercicios Visual Basic

This Visual Basic code defines a form with radio buttons, labels, text boxes, and buttons to perform basic mathematical operations. The radio buttons allow selecting an operation: sum, subtraction, multiplication, or division. The text boxes are used to enter the numbers and display the result. The "Calcular" button performs the calculation based on the selected radio button and displays the result. The "Limpiar" button clears the text boxes. The "Salir" button closes the form.

Uploaded by

angelica1225
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Public Class Form1

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


System.!ventAr"s# $andles BtnCalcular.Click
%im &nac As %ate ' Convert.(o%ate(ime((e)tBo)1.(e)t(##
%im !dad As *nt+,
%im %i&erencia As (imeS-an
%i&erencia ' (oday.Subtract(&nac#
!dad ' Fi)(%i&erencia.(otal%ays . +/0.,0#
(e)tBo),.(e)t(# ' %i&erencia.(otal%ays.(oStrin"
(e)tBo)+.(e)t(# ' %i&erencia.(otal$ours.(oStrin"
(e)tBo)1.(e)t(# ' !dad.(oStrin"
!nd Sub
Private Sub (e)tBo)1_(e)tC2an"ed(ByVal sender As System.Object ByVal
e As System.!ventAr"s# $andles (e)tBo)1.(e)tC2an"ed
*& *s%ate((e)tBo)1.(e)t# (2en
BtnCalcular.!nabled ' (rue
!lse
BtnCalcular.!nabled ' False
!nd *&
!nd Sub
Private Sub Button,_Click(ByVal sender As System.Object ByVal e As
System.!ventAr"s# $andles Button,.Click
%im r As *nt+,
r ' 3essa"eBo).S2o4(5!sta se"uro de salir5 5salir5 _
3essa"eBo)Buttons.6es7o 3essa"eBo)*con.8uestion _
3essa"eBo)%e&aultButton.Button1#
*& r ' 9indo4s.Forms.%ialo":esult.6es (2en
A--lication.!)it(#
!lse
(e)tBo)1.Clear(#
(e)tBo),.Clear(#
(e)tBo)+.Clear(#
(e)tBo)1.Clear(#
(e)tBo)1.Focus(#
!nd *&
!nd Sub
!nd Class
P*C(;:! BO< =CA3B*A: P:OP*!%A% S*>!mO%! A S(:!C$*3A?!
Private Sub (imer1_(ick(ByVal sender As System.Object ByVal e As
System.!ventAr"s# $andles (imer1.(ick
PictureBo),.Visible ' 7ot PictureBo),.Visible
!nd Sub
CA3B*O %! *3A?!7 ;(*@*>A7%O !@ P*C(;:! BO<
(*33!: !7AB@! (*3! ,AAA
CA@C;@A%O:A ;(*@*>A7%O :A%*O B;((O7
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object ByVal e As
System.!ventAr"s# $andles Button1.Click
*& o-csumar.C2ecked (2en
()t+.(e)t ' Val(()t1.(e)t# B Val(()t,.(e)t#
!lse*& O-multi-licar.C2ecked (2en
()t+.(e)t ' Val(()t1.(e)t# C Val(()t,.(e)t#
!lse*& o-cmulti-licar.C2ecked (2en
()t+.(e)t ' Val(()t1.(e)t# D Val(()t,.(e)t#
!lse*& o-cdividir.C2eckAli"n (2en
()t+.(e)t ' Val(()t1.(e)t# . Val(()t,.(e)t#
!nd *&

!nd Sub
Private Sub Button,_Click(ByVal sender As System.Object ByVal e As
System.!ventAr"s# $andles Button,.Click
()t1.(e)t ' 5 5
()t,.(e)t ' 5 5
()t+.(e)t ' 5 5
!nd Sub
Private Sub O-multi-licacion_C2eckedC2an"ed(ByVal sender As
System.Object ByVal e As System.!ventAr"s# $andles
O-cmulti-licar.C2eckedC2an"ed
!nd Sub
Private Sub Button+_Click(ByVal sender As System.Object ByVal e As
System.!ventAr"s# $andles Button+.Click
!nd
!nd Sub
!nd Class
Radio Button
Name Text
OpSuma Suma
OpResta Resta
OpMultiplicar Multiplicar
OpDividir Divisin
Label
Name Text
Label 1 Primer Numero
Label 2 Seundo Numero
Label ! Tercer Numero
TextBox

Name Text
Text 1 Se de"a en Blanco
Text 2 Se de"a en Blanco
Text ! Se de"a en Blanco
Button

Name Text
Button 1 #alcular
Button 2 Limpiar
Button ! Salir

You might also like