You are on page 1of 13

UNIVERSIDAD TECNOLOGICA DE MEXICO

SISTEMAS COMPUTACIONALES

ENTREGABLE 2
PRACTICAS 1-7

GUERRERRO TORRES JORGE

PROGRAMACION ORIENTADA A EVENTOS

SCC08V

PROF. HERIBERTO RODRIGUEZ MENDEZ

18/FEBRERO/2016

INTRODUCCION:
CONOCER Y PRACTICAR LOS TIPOS DE VARIABLES EN VISUAL ESTUDIO
(VISUAL BASIC)

ASI COMO REALIZAR EN LA PRACTICA 6 UNA CALCULADORA BASICA


Y EN EL EJERCIO 7 UN PROYECTO DE UNA CALCULADORA MAS DETALLADA.

DESARROLLO:

A CONTINUACION EN LA SIGUIENTE IMAGEN VEREMOS TIPOS DE


VARIABLES QUE SE USAN EN VISUAL BASIC.NET
Los distintos tipos de variables utilizados en Visual Basic son:
Integer

Valor Entero

2 Bytes

Long

Valor Entero Largo

4 Bytes

Single

Valor Real

4 Bytes

Double

Valor Real Doble

8 Bytes

String

Carcter (texto)

1 Byte por carcter

Byte

Byte

1 Byte

Boolean

Valor Booleano (1/0)

2 Bytes

Currency

Monedas y Punto Fijo

8 Bytes

Date

Fecha

8 Bytes

Object

Referencias a objetos

4 Bytes

Variant

Cualquiera

16-22 Bytes

pg. 1

PRACTICA 1
EXPLICAR LA FUNCIONALIDAD DE CADA UNO DE LOS MSGBox con
ejemplo.
MsgBox("adios mundo", MsgBoxStyle.Question, "guerrero"
Cdigo
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MsgBox("hola mundo", MsgBoxStyle.Exclamation, "jorge")
MsgBox("adios mundo", MsgBoxStyle.Question, "guerrero")
MsgBox("ingeniero en sistemas", MsgBoxStyle.Exclamation, "unitec")
MsgBox("especialidad en redes", MsgBoxStyle.Information, "curso")
MsgBox("estudiante", MsgBoxStyle.YesNo, "estudiante universitario")
MsgBox("soporte tecnico", MsgBoxStyle.MsgBoxHelp, "certificacion")
MsgBox("instructor de videojuegos", MsgBoxStyle.MsgBoxRight, "catalogo")
MsgBox("profesor sec", MsgBoxStyle.OkOnly, "empleo")
End Sub
End Class

pg. 2

PRACTICA 2

DECLARACION DE VARIABLE TIPO TEXTO


Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim texto1 As String = "jorge guerrero torres"
MsgBox(texto1)
Dim texto2 As String = "ingeniero en sistemas"
MsgBox(texto2)
Dim texto3 As String = "especialidad en video juegos"
MsgBox(texto3)
Dim texto4 As String = "profesor en educacion secundaria"
MsgBox(texto4)
Dim texto5 As String = "mantenimiento en pc y videojuegos"
MsgBox(texto5)
Dim texto6 As String = "mantenimiento pc y redes"
MsgBox(texto6)
Dim texto7 As String = "estudiante de ingienieria en sistemas"
MsgBox(texto7)
End Sub
End Class

pg. 3

PRACTICA 3
DECLARACION DE LA VARIABLE INTERGER

CODIGO
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim variable1 As Integer = 5
MsgBox(variable1, MsgBoxStyle.Exclamation, "Mi edad es:")
variable1 = 2
MsgBox(variable1, MsgBoxStyle.Information, "Mi hija monse tiene:")
variable1 = 4
MsgBox(variable1, MsgBoxStyle.Critical, "Mi hija monse tiene: ")
End Sub
End Class

pg. 4

PRACTICA 4
DECLARACION DE LA VARIABLE DOUBLE

CODIGO

Public Class Form1


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim variable1 As Double = 1.75
MsgBox(variable1, MsgBoxStyle.Exclamation, "Mi altura en metros es:")
variable1 = 84.7
MsgBox(variable1, MsgBoxStyle.Information, "Mi peso en kgs es:")
variable1 = 80.9
MsgBox(variable1, MsgBoxStyle.Critical, "Mi promedio en la UNIVERSIDAD
fue:")
End Sub
End Class

pg. 5

PRACTICA 5
DLECARACION DE VARIABLES TIPO DATA
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim variable1 As Date = "07-01-81"
MsgBox(variable1, MsgBoxStyle.Exclamation, "Mi fecha se nacimiento es :")
variable1 = "23-11-02"
MsgBox(variable1, MsgBoxStyle.Information, "Mi fecha de graduacion fue:")
variable1 = "06-08-03"
MsgBox(variable1, MsgBoxStyle.Critical, "Mi primer empleo como ingeniero
fue:")

End Sub
End Class

pg. 6

Practica 6

Calculadora sencilla
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub btn_suma_Click(sender As Object, e As EventArgs) Handles
btn_suma.Click
text_resultado.Text = Val(text_1.Text) + Val(text_2.Text)

End Sub
Private Sub btn_resta_Click(sender As Object, e As EventArgs) Handles
btn_resta.Click
text_resultado.Text = Val(text_1.Text) - Val(text_2.Text)
End Sub
Private Sub btn_multiplicacion_Click(sender As Object, e As EventArgs) Handles
btn_multiplicacion.Click
text_resultado.Text = Val(text_1.Text) * Val(text_2.Text)
End Sub
Private Sub btn_divicion_Click(sender As Object, e As EventArgs) Handles
btn_divicion.Click
text_resultado.Text = Val(text_1.Text) / Val(text_2.Text)
End Sub
Private Sub btn_limpiar_Click(sender As Object, e As EventArgs) Handles
btn_limpiar.Click
text_1.Text = " "
text_2.Text = " "
End Sub
Private Sub btn_salir_Click(sender As Object, e As EventArgs) Handles
btn_salir.Click
End
End Sub
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles
btn_valor1.Click
End Sub
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles valor_2.Click
End Sub
Private Sub text_resultado_TextChanged(sender As Object, e As EventArgs) Handles
text_resultado.TextChanged
End Sub

pg. 7

Private Sub text_1_TextChanged(sender As Object, e As EventArgs) Handles


text_1.TextChanged
End Sub
End Class

Suma

Resta

Multiplicacion

Dividir

pg. 8

PRACTICA 7
PROYECTO DE CALCULADORA

Public Class Form1


Dim DATO As Double
Dim DATO2 As Double
Dim RESUL As Double
Dim OPE As Double

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles BT3.Click


DATO2 = Val(resultado.Text)
If OPE = 1 Then
RESUL = DATO + DATO2
resultado.Text = RESUL
Else
If OPE = 2 Then
RESUL = DATO - DATO2
resultado.Text = RESUL
Else
If OPE = 3 Then
RESUL = DATO * DATO2
resultado.Text = RESUL
Else
If OPE = 4 Then
RESUL = DATO / DATO2
resultado.Text = RESUL
End If

End If
End If
End If
End Sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles BT12.Click
resultado.Text = resultado.Text & "4"
End Sub
Private Sub Button16_Click(sender As Object, e As EventArgs) Handles BT13.Click
OPE = 1
DATO = Val(resultado.Text)
resultado.Clear()
End Sub
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles BT16.Click
resultado.Text = resultado.Text & "7"
End Sub
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles BT9.Click
OPE = 2

pg. 9

DATO = Val(resultado.Text)
resultado.Clear()
End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles BT11.Click
resultado.Text = resultado.Text & "5"
End Sub
Private Sub BT17_Click(sender As Object, e As EventArgs) Handles BT17.Click
resultado.Clear()
End Sub
Private Sub BT1_Click(sender As Object, e As EventArgs) Handles BT1.Click
resultado.Text = resultado.Text & "0"
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Button3.Click
resultado.Text = resultado.Text & "."

End Sub
Private Sub BT4_Click(sender As Object, e As EventArgs) Handles BT4.Click
OPE = 4
DATO = Val(resultado.Text)
resultado.Clear()

End Sub
Private Sub BT5_Click(sender As Object, e As EventArgs) Handles BT5.Click
OPE = 3
DATO = Val(resultado.Text)
resultado.Clear()
End Sub
Private Sub BT6_Click(sender As Object, e As EventArgs) Handles BT6.Click
resultado.Text = resultado.Text & "3"
End Sub
Private Sub BT7_Click(sender As Object, e As EventArgs) Handles BT7.Click
resultado.Text = resultado.Text & "2"
End Sub
Private Sub BT8_Click(sender As Object, e As EventArgs) Handles BT8.Click
resultado.Text = resultado.Text & "1"
End Sub
Private Sub BT10_Click(sender As Object, e As EventArgs) Handles BT10.Click
resultado.Text = resultado.Text & "6"
End Sub
Private Sub BT14_Click(sender As Object, e As EventArgs) Handles BT14.Click
resultado.Text = resultado.Text & "9"

pg. 10

End Sub
Private Sub BT15_Click(sender As Object, e As EventArgs) Handles BT15.Click
resultado.Text = resultado.Text & "8"
End Sub
Private Function BTN2() As Object
Throw New NotImplementedException
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class

SUMA

RESTA

pg. 11

CONCLUCIONES:
Al resolver todas las practicas del del 1 al 5, nos da a ganar la habilidad
De realizar un proyecto en el cual se ven reflejadas esas habilidades como
es el caso de realizar una prctica de la calculadora ms estructurada.
Aplicar los comandos bsicos, la declaracin de variables interger, doubled,
texto etc. Para podemos realizar cualquier proyecto.
Resumo que para realizar un proyecto lo primero que tenemos que hacer es
Abrir el programa de visual estudio en aplicaciones de Windows ponerle un
nombre al proyecto.
1) empezaremos a dibujar los botones
Cambiarles nombre para identificarlos y poderlos programar
2) Declarar variables
3) Empezar a programar

pg. 12

You might also like