1. UNIVERSIDAD TÉCNICA
DE AMBATO
FACULTAD DE CIENCIAS HUMANAS
Y LA EDUCACIÓN
CARRERA DE DOCENCIA EN
INFORMÁTICA
LÓGICA DE PROGRAMACIÓN I
DOCENTE: ING. WILMA GAVILANEZ
ELEMENTO 3: PROGRAMAS EN
VISUAL BASIC 2008 CON ACCESS
2010
NOMBRE: DIEGO CHICAIZA PAREDES
2. PROGRAMACION I U.T.A 5to “U”
Elemento 3.
Ejercicios de programación en Microsoft Visual Studio 2008 enlazada con Microsoft
Access 2010
EJERCICIO 1
Realice un programa que me permita visualizar una caratula con los datos personales y
logos de la Universidad Técnica de Ambato y la Facultad de Ciencias Humanas y la
Educación.
Label1= Universidad Tecnica de Ambato
Label2= Facultad de Ciencias Humanas y la Educacion
Labels3=Carrera de Docencia en Informatica
Label4= nombre
Label5= nombre de la Ingeniera
Label6= nombre de la materia
Label7= nombre del semestre
Label8= período academico
Picturebox1= insertar imagenes
Logo de la universidad
Logo de la carrera
Como primer paso es crear un formulario para la creacion de la caratula.
2 FCHE DIEGO CHICAIZA
3. PROGRAMACION I U.T.A 5to “U”
Insertamos los label correspondientes para la realizacion del programa
Una vez modificado los label damos formato a cada uno de ellos.
3 FCHE DIEGO CHICAIZA
4. PROGRAMACION I U.T.A 5to “U”
Ahora colocamos los picturebox.
Insertamos la imagen en cada uno de los picturebox seleccionados
4 FCHE DIEGO CHICAIZA
5. PROGRAMACION I U.T.A 5to “U”
Importamos el sello de la Carrera.
Importamos el sello de la Universidad Tecnica de Ambato.
5 FCHE DIEGO CHICAIZA
6. PROGRAMACION I U.T.A 5to “U”
La caratula está culminada.
Este es la caratula cuando la ejecutemos.
6 FCHE DIEGO CHICAIZA
7. PROGRAMACION I U.T.A 5to “U”
CONCLUSION.
Este programa da a conocer que el label es una herramienta que puede ser utilizada y
modificada a nuestra manera.
EJERCICIO 2
Realice un programa que me permita ingresar los datos personales del usuario.
DESCRIPCION.
Este es un programa que me permitirá ingresar los datos personales de una persona n
veces y visualizarlos con un msgbox.
Utilizaremos cinco label para nombrar cada uno de los objetos
label1=Titulo
label2=nombre
label3=apellido
label4=direccion
label5=telefono
Utilizaremos dos botones.
buton 1= nuevo
buton 2= salir
CODIFICACION DEL BOTON NUEVO
Private Sub cmdnuevo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdnuevo.Click
txtnombre.Text = ""
txtapellido.Text = ""
txtdireccion.Text = ""
txttelefono.Text = ""
End Sub
End Class
CODIFICACIÓN DEL BOTON SALIR
Private Sub cmdsalir_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdsalir.Click
End
7 FCHE DIEGO CHICAIZA
8. PROGRAMACION I U.T.A 5to “U”
End Sub
EJECUCION DEL PROGRAMA
Ingresamos dos datos necesarios
8 FCHE DIEGO CHICAIZA
9. PROGRAMACION I U.T.A 5to “U”
Una vez culminada el ingreso de datos seleccionamos el boton nuevo y se limpiaran los
textbox ingresados.
CONCLUSION
En el programa podemos observar que es posible blanquear los textbox mediante una
corta codificacion en el boton nuevo.
EJERCICIO 3
APLICACIÓN.
Diseñe un proyecto que visualice un las regiones de nuestro Ecuador
DESCRIPCION.
Diseñaremos nuestro formulario en el cual utilizaremos Objeto como Label, TextBox,
Button, ComboBox, el cual nos permitirá diseñar nuestra aplicación.
Utilizaremos 6 form para ubicar cada uno de las regiones del Ecuador.
Form1= caratula principal.
Form2= selección de la regiones del Ecuador.
Form3= región sierra.
Form4= región costa.
Form5= región amazónica.
Form6= región insular.
Utilizaremos 9 label.
Label1= Ecuador Biodiverso.
Form2= región Sierra.
Form3= concepto de la región sierra.
9 FCHE DIEGO CHICAIZA
10. PROGRAMACION I U.T.A 5to “U”
Form4= región costa.
Form5= concepto de la región costa.
Form6= región amazónica.
Form7= concepto de la región amazónica.
Form8= región insular.
Form9= concepto de la región insular.
Utilizaremos seis botones.
Boton1= ingrese la contraseña.
Botton2= salir.
Botton3= costa.
Botton4= sierra.
Botton5= oriente.
Botton6= región insular.
Botton7= salir.
Botton8= regresar al menu.
Botton9= regresar al menu.
Botton10= regresar al menu.
Botton11= regresar al menu.
Utilizaremos un textbox para el ingreso de la contraseña.
Textbox1= contraseña
CODIFICACION DE LA CONTRASEÑA EN EL BOTTON1.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles contraseña.Click
If (TextBox1.Text = 1234) Then
Me.Hide()
Form2.Show()
Else
MsgBox("INGRESE NUEVAMENTE LA CONTRASEÑA")
TextBox1.Focus()
TextBox1.SelectionStart = 0
TextBox1.Text = ""
End If
End Sub
CODIFICACION DE SALIR EN EN BOTTON2
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
End
End Sub
End Class
10 FCHE DIEGO CHICAIZA
11. PROGRAMACION I U.T.A 5to “U”
CODIFICACION DE CADA UNO DE LOS FORM PARA QUE SE OCULTEN Y
APAREZCA EL FORM SELECCIONADO.
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Me.Hide()
Form1.Show()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Me.Hide()
Form3.Show()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
Me.Hide()
Form4.Show()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button4.Click
Me.Hide()
Form5.Show()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button5.Click
Me.Hide()
Form6.Show()
End Sub
End Class
EJECUCIÓN DEL PROGRAMA.
Ingresamos la contraseña antes predeterminada.
11 FCHE DIEGO CHICAIZA
12. PROGRAMACION I U.T.A 5to “U”
Ahora se aparcera el segundo form en donde seleccionaremos la región que deseamos.
Región costa.
12 FCHE DIEGO CHICAIZA
13. PROGRAMACION I U.T.A 5to “U”
Cuande queremos regresar al menu simplemente damos clic en regresar al menu.
Región sierra.
Region amazónica.
13 FCHE DIEGO CHICAIZA
14. PROGRAMACION I U.T.A 5to “U”
Región insular.
CONCLUSIÓN.
En este programa aprenderemos a codificar una contraseña mediante un boton y un
textbox y también a ocultar y desaparecer un form mediante un boton.
EJERCICIO 4
INGRESO DE 3 NOTAS
En el siguiente ejercicio vamos a ingresar el nombre del alumno, nombre del módulo, las nota
de deberes, lecciones y exámenes, el promedio de las tres notas y la equivalencia.
El ingreso de notas va a ser validadas hasta un límite de 10.
La equivalencia: promedio >=7 APROBADO
promedio >5 y <7 SUSPENSO
promedio <5 REPROBADO
Utilizaremos los siguientes label (form1).
Label1= Bienvenidos
Label2= Usuario
Label3= Contraseña
Utilizaremos los siguientes textbox (form1)
14 FCHE DIEGO CHICAIZA
15. PROGRAMACION I U.T.A 5to “U”
Textbox1=textbox1
Textbox2=textbox2
Utlizaremos un boton para la validacion de la contraseña ingresada.
Button1=ingresar notas
Utilizaremos los siguientes label (form2).
Label1= control de notas.
Label2= Nombre.
Label3= Módulo.
Label4= Deberes.
Label5= Lecciones.
Label6= Exámenes.
Label7= Promedio.
Label8= Equivalencia.
Utilizaremos los siguienest textbox.
Textbox1= textbox1
Textbox2= textbox2
Textbox3= textbox3
Textbox4= textbox4
Textbox5= textbox5
Textbox6= textbox6
Textbox7= textbox7
Utilizaremos dos botones.
Button1= nuevo
Button2=salir
CODIFICADO DEL PROGRAMA
(form1)
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
If (txtcontraseña.Text = 1234) Then
Me.Hide()
Form2.Show()
Else
MsgBox("USTED NO PUEDE INGRESAR AL CONTROL DE NOTAS")
txtcontraseña.Focus()
txtcontraseña.SelectionStart = 0
txtcontraseña.Text = ""
End If
End Sub
End Class
15 FCHE DIEGO CHICAIZA
16. PROGRAMACION I U.T.A 5to “U”
(form2)
Public Class Form2
Private Sub TextBox3_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TextBox3.TextChanged
TextBox6.Text = (((Val(TextBox3.Text)) + (Val(TextBox4.Text))
+ (Val(TextBox5.Text))) / 3)
If (Val(TextBox3.Text)) > 1 And (Val(TextBox3.Text)) <= 10
Then
Else
MsgBox("INGRESE UN VALOR ENTRE 1 Y 10")
TextBox3.Text = ""
TextBox3.Focus()
End If
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TextBox4.TextChanged
If (Val(TextBox4.Text)) > 1 And (Val(TextBox4.Text)) <= 10
Then
Else
MsgBox("INGRESE LOS UN VALOR ENTRE 1 Y 10")
TextBox4.Text = ""
TextBox4.Focus()
End If
TextBox6.Text = (((Val(TextBox3.Text)) + (Val(TextBox4.Text))
+ (Val(TextBox5.Text))) / 3)
End Sub
Private Sub TextBox5_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TextBox5.TextChanged
If (Val(TextBox5.Text)) > 1 And (Val(TextBox5.Text)) <= 10
Then
Else
MsgBox("INGRESE UN VALOR ENTRE 1 Y 10")
TextBox5.Text = ""
TextBox5.Focus()
End If
TextBox6.Text = (((Val(TextBox3.Text)) + (Val(TextBox4.Text))
+ (Val(TextBox5.Text))) / 3)
If (TextBox6.Text >= 7) Then
TextBox7.Text = ("APROBADO")
ElseIf (TextBox6.Text < 7) And (TextBox6.Text > 5) Then
TextBox7.Text = ("SUSPENSO")
ElseIf (TextBox6.Text < 4) Then
TextBox7.Text = ("REPRUEBA")
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
16 FCHE DIEGO CHICAIZA
17. PROGRAMACION I U.T.A 5to “U”
End
End Sub
End Class
IMÁGENES DE LA EJECUCION DEL PROGRAMA.
Ingresamos las notas correspondientes para ver la equivalencia del promedio de notas.
17 FCHE DIEGO CHICAIZA
18. PROGRAMACION I U.T.A 5to “U”
CONCLUSION.
En este programa podemos ver que la ejecucion va interconectada con sentencias
anidadas, esto quiere decir que si no es la primera opción es la segunda.
EJERCICIO 5
TEMA: TABLA DE MULTIPLICAR
1. Abrir un nuevo Proyecto en Visual Basic
Los elementos que vamos a utilizar son 3 form
Form1
Utilizaremos los siguientes label.
Label1= Tablas de multiplicar.
Utlilizaremos un segundo form.
Form2
Utilizaremos los siguientes label.
Label3= Tablas.
Label1= Ingrese el factor.
Label2= Ingrese el limite.
Utilizaremos los siguientes textbox.
Textbox1
Textbox2
Utilizaremos tres botones.
Button1= Regresar
Burron2= Generar.
Button3= Nuevo.
Utilizaresmo un listbox.
Listbox1
Utilizaresmo un form.
Form3
18 FCHE DIEGO CHICAIZA
19. PROGRAMACION I U.T.A 5to “U”
Utilizaremos un label
Label1= Ingrese el limute.
Utilizaremos los siguientes botones.
Button1= Fibonacci
Button2= Faactorial
Button3= Primos
Button4= Limpiar
Button5= Salir
Utilizaremos un textbox.
Textbox1
CODIFICACION DEL PROGRAMA.
(form1)
Public Class Form1
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles PictureBox2.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Me.Hide()
Form2.Show()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
End
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Me.Hide()
Form3.Show()
End Sub
End Class
(form2)
Public Class Form2
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
Me.Hide()
19 FCHE DIEGO CHICAIZA
20. PROGRAMACION I U.T.A 5to “U”
Form1.Show()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Dim ml As Integer
For INICIO = 1 To Val(TextBox2.Text) Step 1
ml = Val(TextBox1.Text) * INICIO
ListBox1.Items.Add(INICIO & "*" & Val(TextBox1.Text) & "="
& ml)
Next
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
ListBox1.Items.Clear()
TextBox1.Clear()
TextBox2.Clear()
End Sub
End Class
(form3)
Public Class Form3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim fib As Integer
Dim a As Integer = 1
Dim b As Integer = 0
Dim c As Integer = 0
Dim contador As Integer = 0
For INICIO = 1 To Val(txtlimite.Text) Step 1
b = a
a = c
c = a + b
ListBox1.Items.Add(c)
Next
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button4.Click
ListBox1.Items.Clear()
ListBox2.Items.Clear()
ListBox3.Items.Clear()
txtlimite.Clear()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Dim x, fac As Integer
x = txtlimite.Text
fac = 1
20 FCHE DIEGO CHICAIZA
21. PROGRAMACION I U.T.A 5to “U”
For INICIO = x To 1 Step -1
fac = fac * INICIO
Next
ListBox2.Items.Add(fac)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
Dim compro As Boolean = True
Dim numero As Integer
For numero = 1 To Val(txtlimite.Text) * 2
compro = True
For INICIO = 2 To numero - 1
If numero Mod INICIO = 0 Then
compro = False
End If
Next
If compro = True Then
ListBox3.Items.Add(numero)
End If
Next
End Sub
End Class
IMAGENES DE LA EJECUCION DEL PROGRAMA.
21 FCHE DIEGO CHICAIZA
22. PROGRAMACION I U.T.A 5to “U”
Generamos la tabla de multiplicar.
Ingresamos a datos de serie e ingresamos el limite en que deseamos.
22 FCHE DIEGO CHICAIZA
23. PROGRAMACION I U.T.A 5to “U”
Generamos Fibonacci.
Generamos el Factorial.
23 FCHE DIEGO CHICAIZA
24. PROGRAMACION I U.T.A 5to “U”
Generamos los numero primos.
CONCLUSION.
El programa anterior ingresamos un listbox en donde podemos visualizar los resultados
requeridos y ya no utilizaremos en msgbox.
EJERCICIO 6
GENERAR UNA PROFORMA (VINOS Y LICORES)
Diseñe un programa que me permita realizar una proforma en donde se visualice una
imagen del producto el precio unitario y precio total.
Utilizaremos un solo form.
Form1
Utilizaremos los siguientes label.
Label1= Vinos y licores
Label2= Licores.
Label3= Cantidad.
Label4= Precio Unitario.
Label5= Precio total.
24 FCHE DIEGO CHICAIZA
25. PROGRAMACION I U.T.A 5to “U”
Label6= Forma de pago
Label7= Iva 12%
Label8= total.
Utilizaremos un picturebox.
Picturebox.
Utilizaremos un combobox.
Combobox1.
Utilizaremos los siguientes textbox.
Txtcantidad.
Txtunitario.
Txtsubtotal
Txtiva.
Txttotal.
Utilizarmos los siguientes checkbox.
Checkbox1=recargo
Checkbox2=contado
Utilizaremos un boton para el limpiado de los textbox.
Button1=limpiar.
CODIFICACION DEL PROGRAMA.
OJO: las imágenes no se visualizaran ya que la direccion se encuentra es de otro
ordenador.
Public Class Form1
Dim datos1 As Double
Dim datos As Integer
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
datos = ComboBox1.SelectedIndex
If datos = 0 Then
txtunitario.Text = (Val("180.50"))
datos1 = txtunitario.Text
PictureBox1.Load("C:UsersLab6DesktopIMAGENESVODKA.jpg")
ElseIf datos = 1 Then
txtunitario.Text = (Val("99.99"))
datos1 = txtunitario.Text
25 FCHE DIEGO CHICAIZA
26. PROGRAMACION I U.T.A 5to “U”
PictureBox1.Load("C:UsersLab6DesktopIMAGENESJOHNNYAZUL.jpg")
ElseIf datos = 2 Then
txtunitario.Text = (Val("130.00"))
datos1 = txtunitario.Text
PictureBox1.Load("C:UsersLab6DesktopIMAGENESCHIVASREGAL.jpg")
ElseIf datos = 3 Then
txtunitario.Text = (Val("120.50"))
datos1 = txtunitario.Text
PictureBox1.Load("C:UsersLab6DesktopIMAGENESJOHNNYVERDE.jpg")
ElseIf datos = 4 Then
txtunitario.Text = (Val("200.00"))
datos1 = txtunitario.Text
PictureBox1.Load("C:UsersLab6DesktopIMAGENESSOMETHIMES.jpg")
End If
End Sub
Private Sub txttotal_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtsubtotal.TextChanged
End Sub
Private Sub txtcantidad_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtcantidad.TextChanged
txtsubtotal.Text = Format(Val(txtcantidad.Text) * datos1,
"###.00")
txtiva.Text = Format((Val(txtsubtotal.Text) * 0.12), "###.00")
txttotal.Text = Format((Val(txtsubtotal.Text)) +
(Val(txtiva.Text)))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
txtcantidad.Clear()
txtiva.Clear()
txttotal.Clear()
txtsubtotal.Clear()
txtunitario.Clear()
CheckBox1.Enabled = True
CheckBox2.Enabled = True
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CheckBox1.CheckedChanged
CheckBox1.Text = Format((Val(txttotal.Text)) +
(Val(txttotal.Text) * 0.15), "###.00")
If CheckBox1.Checked = True Then
CheckBox2.Enabled = False
ElseIf CheckBox1.Checked = False Then
CheckBox2.Enabled = True
CheckBox1.Enabled = False
End If
End Sub
26 FCHE DIEGO CHICAIZA
27. PROGRAMACION I U.T.A 5to “U”
Private Sub CheckBox2_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CheckBox2.CheckedChanged
CheckBox2.Text = Format((Val(txttotal.Text)) -
(Val(txttotal.Text) * 0.2), "###.00")
If CheckBox2.Checked = True Then
CheckBox1.Enabled = False
ElseIf CheckBox2.Checked = False Then
CheckBox1.Enabled = True
CheckBox2.Enabled = True
End If
End Sub
End Class
IMÁGENES DE LA EJECUCION DEL PROGRAMA.
27 FCHE DIEGO CHICAIZA
28. PROGRAMACION I U.T.A 5to “U”
Escojemos el tipo de licor que deseamos.
Ahora nos aparecera si deseamos pagar de forma de contado o a credito.
28 FCHE DIEGO CHICAIZA
29. PROGRAMACION I U.T.A 5to “U”
CONCLUSION.
El programa anterior prodremos observar que con el combobox podemosescojer una
opcion y además se puede visualizar una imagen que se haya escojigo o descargado del
internet.
EJERCICIO 7
Diseñe una aplicación utilizando los números randomicos
En este programa veremos cómo manejar números randomicos para lo cual
realizaremos un proyecto llamado casino
En este proyecto utilizamos algunos objetos como:
Utilizaremos un FORM1
Form1
Utilizaremos los siguientes label
Label1=Título principal (Casino)
Label2=son los subtítulos ( 0 )
Label3=son los subtítulos ( 0 )
Label4=son los subtítulos ( 0 )
Utilizaremos dos botones.
Button1= Para el botón Jugar (cmdjugar)
Button2= Para el botón salir (cmdsalir)
Utilizaremos dos picturebox
Picturebox1= Utilizaremos para agregar la primera imagen
PictureBox2= Utilizaremos para agregar la segunda imagen
CODIFICACION DEL PROGRAMA.
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim n1 As Byte
Dim n2 As Byte
29 FCHE DIEGO CHICAIZA
30. PROGRAMACION I U.T.A 5to “U”
Dim n3 As Byte
Randomize()
Do
n1 = Int(Rnd() * 10)
n2 = Int(Rnd() * 10)
n3 = Int(Rnd() * 10)
Loop While (n1 > 1) And (n1 <= 6)
Label2.Text = n1
Label3.Text = n2
Label4.Text = n3
If (Label2.Text = Label3.Text) And (Label2.Text = Label4.Text)
Then
PictureBox1.Visible = True
PictureBox2.Visible = False
MsgBox("Felicidades Ganaste")
Else
PictureBox2.Visible = True
PictureBox1.Visible = False
MsgBox("Fallaste Intentalo nuevamente")
End If
End Sub
End Class
IMÁGENES DE LA EJECUCION DEL PROGRAMA.
30 FCHE DIEGO CHICAIZA
31. PROGRAMACION I U.T.A 5to “U”
Ahora comenzaremos a jugar el casino.
EJERCICIO 8
Desarrollo de una proforma de las partes del computador
Utilizaremos un form1
Form1
Utilizaremos los siguientes labels.
Label1= Venta de pc y accesorios.
Label2= Ingrese el usuario.
Label3= Ingrese la contraseña.
Utilizaremos textbox-
Txtunuario.
Txtcontraseña.
Utilizaremos un form2
Form2
Utilizaremos un picturobox.
31 FCHE DIEGO CHICAIZA
32. PROGRAMACION I U.T.A 5to “U”
Picturebox.
Utilizaremos los siguientes label.
Label1= Mainboard
Label2= Memoria RAM
Label3= Disco duro
Label4= Unidades opticas
Label5= Monitor
Label6= Procesador
Label7= Cantidad
Label8= Precio Unitario
Label9= Subtotal
Label10= Valor del precio.
Label11= Forma de pago
Label12= Valor a cancelar.
Utilizaremos los soguientes combobox.
Combobox1
Combobox2
Combobox3
Combobox4
Combobox5
Combobox6
Utilizaremos los siguientes textbox.
Txtcantidad1
Txtcantidad2
Txtcantidad3
Txtcantidad4
Txtcantidad5
Txtcantidad6
Txtunitario1
Txtunitario2
Txtunitario3
Txtunitario4
Txtunitario5
Txtunitario6
Txtsubtotal1
Txtsubtotal2
Txtsubtotal3
Txtsubtotal4
32 FCHE DIEGO CHICAIZA
33. PROGRAMACION I U.T.A 5to “U”
Txtsubtotal5
Txtsubtotal6
Txtvalor1
Txtvalor2
Txtvalor3
Txtvalor4
Txtvalor5
Txtvalor6
Txtiva1
Txtiva2
Txtiva3
Txtiva4
Txtiva5
Txtiva6
Txtcancelar
Utilizaremos un checkbox.
Checkbox1
Utilizaremos los siguientes botones.
Button1= Limpiar valores
Button2= Regresar al menu principal
Button3= Finalizar.
CODIFICACIÓN DEL PROGRAMA.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
If txtcontraseña.Text = 1234 Then
Me.Hide()
Form2.Show()
Else
MsgBox(" INGRESE NUEVAMENTE LA CONTRASEÑA ")
txtcontraseña.Focus()
txtcontraseña.SelectionStart = 0
txtcontraseña.Text = ""
End If
End Sub
Private Sub txtcontraseña_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtcontraseña.TextChanged
End Sub
End Class
(FORM2)
33 FCHE DIEGO CHICAIZA
34. PROGRAMACION I U.T.A 5to “U”
Public Class Form2
Dim datos1, datos2, datos3, datos4, datos5, datos6 As Double
Dim datos As Integer
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
datos = ComboBox1.SelectedIndex
If datos = 0 Then
txtunitario1.Text = (Val("120.85"))
datos1 = txtunitario1.Text
PictureBox1.Load("J:PARTES COMPUTADORAMAINBOARDAMD.jpg")
ElseIf datos = 1 Then
txtunitario1.Text = (Val("130.45"))
datos1 = txtunitario1.Text
PictureBox1.Load("J:PARTES
COMPUTADORAMAINBOARDINTEL.jpg")
ElseIf datos = 2 Then
txtunitario1.Text = (Val("149.59"))
datos1 = txtunitario1.Text
PictureBox1.Load("J:PARTES
COMPUTADORAMAINBOARDBIOSTAR.jpg")
End If
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox2.SelectedIndexChanged
datos = ComboBox2.SelectedIndex
If datos = 0 Then
txtunitario2.Text = (Val("30.45"))
datos2 = txtunitario2.Text
PictureBox1.Load("J:PARTES
COMPUTADORADDR1MARKVISION.jpg")
ElseIf datos = 1 Then
txtunitario2.Text = (Val("35.90"))
datos2 = txtunitario2.Text
PictureBox1.Load("J:PARTES COMPUTADORADDR2-1GB
KINGSTON.jpg")
ElseIf datos = 2 Then
txtunitario2.Text = (Val("15.67"))
datos2 = txtunitario2.Text
PictureBox1.Load("J:PARTES COMPUTADORADDR2-512MB.jpg")
ElseIf datos = 3 Then
txtunitario2.Text = (Val("20.45"))
datos2 = txtunitario2.Text
PictureBox1.Load("J:PARTES COMPUTADORADDR512MB.jpg")
End If
End Sub
Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox3.SelectedIndexChanged
datos = ComboBox3.SelectedIndex
If datos = 0 Then
txtunitario3.Text = (Val("68.75"))
datos3 = txtunitario3.Text
PictureBox1.Load("J:PARTES COMPUTADORAHITACHI160GB.jpg")
ElseIf datos = 1 Then
txtunitario3.Text = (Val("120.32"))
datos3 = txtunitario3.Text
PictureBox1.Load("J:PARTES COMPUTADORAMAXTOR500GB.jpg")
34 FCHE DIEGO CHICAIZA
35. PROGRAMACION I U.T.A 5to “U”
ElseIf datos = 2 Then
txtunitario3.Text = (Val("146.65"))
datos3 = txtunitario3.Text
PictureBox1.Load("J:PARTES COMPUTADORASAMSUMG1TB.jpg")
ElseIf datos = 3 Then
txtunitario3.Text = (Val("130.23"))
datos3 = txtunitario3.Text
PictureBox1.Load("J:PARTES
COMPUTADORASEAGATE500GBSATA.jpg")
End If
End Sub
Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox4.SelectedIndexChanged
datos = ComboBox4.SelectedIndex
If datos = 0 Then
txtunitario4.Text = (Val("45.10"))
datos4 = txtunitario4.Text
PictureBox1.Load("J:PARTES COMPUTADORACDDVDLG.jpg")
ElseIf datos = 1 Then
txtunitario4.Text = (Val("38.98"))
datos4 = txtunitario4.Text
PictureBox1.Load("J:PARTES COMPUTADORACDDVDROMASUS.jpg")
End If
End Sub
Private Sub ComboBox5_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox5.SelectedIndexChanged
datos = ComboBox5.SelectedIndex
If datos = 0 Then
txtunitario5.Text = (Val("250.23"))
datos5 = txtunitario5.Text
PictureBox1.Load("J:PARTES
COMPUTADORAMONITORHPTOUCHSCREEM.jpg")
ElseIf datos = 1 Then
txtunitario5.Text = (Val("198,44"))
datos5 = txtunitario5.Text
PictureBox1.Load("J:PARTES COMPUTADORAMONITORLGLCD.jpg")
ElseIf datos = 2 Then
txtunitario5.Text = (Val("230.45"))
datos5 = txtunitario5.Text
PictureBox1.Load("J:PARTES
COMPUTADORAMONITORLGLCDLED.jpg")
End If
End Sub
Private Sub ComboBox6_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox6.SelectedIndexChanged
datos = ComboBox6.SelectedIndex
If datos = 0 Then
txtunitario6.Text = (Val("89.34"))
datos6 = txtunitario6.Text
PictureBox1.Load("J:PARTES
COMPUTADORAPROCESADORAMDOPTERON.jpg")
ElseIf datos = 1 Then
txtunitario6.Text = (Val("95.31"))
datos6 = txtunitario6.Text
35 FCHE DIEGO CHICAIZA
36. PROGRAMACION I U.T.A 5to “U”
PictureBox1.Load("J:PARTES
COMPUTADORAPROCESADORAMDSEMRON.jpg")
ElseIf datos = 2 Then
txtunitario6.Text = (Val("100.01"))
datos6 = txtunitario6.Text
PictureBox1.Load("J:PARTES
COMPUTADORAPROCESADORATHLONX2.jpg")
ElseIf datos = 3 Then
txtunitario6.Text = (Val("110.34"))
datos6 = txtunitario6.Text
PictureBox1.Load("J:PARTES
COMPUTADORAPROCESADORINTELCORE2DUO.jpg")
ElseIf datos = 4 Then
txtunitario6.Text = (Val("120.89"))
datos6 = txtunitario6.Text
PictureBox1.Load("J:PARTES
COMPUTADORAPROCESADORINTELDUALCORE.jpg")
ElseIf datos = 5 Then
txtunitario6.Text = (Val("145.54"))
datos6 = txtunitario6.Text
PictureBox1.Load("J:PARTES
COMPUTADORAPROCESADORINTELCOREi3.jpg")
ElseIf datos = 6 Then
txtunitario6.Text = (Val("168.99"))
datos6 = txtunitario6.Text
PictureBox1.Load("J:PARTES
COMPUTADORAPROCESADORINTELCOREi5.jpg")
ElseIf datos = 7 Then
txtunitario6.Text = (Val("188.99"))
datos6 = txtunitario6.Text
PictureBox1.Load("J:PARTES
COMPUTADORAPROCESADORINTELCOREi7.jpg")
End If
End Sub
Private Sub txtcantidad1_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtcantidad1.TextChanged
txtsubtotal1.Text = Format((Val(txtcantidad1.Text) * datos1),
"##.000")
txtiva1.Text = Format((Val(txtsubtotal1.Text) * 0.12),
"##.000")
txtvalor1.Text = Format((Val(txtsubtotal1.Text)) +
(Val(txtiva1.Text)))
End Sub
Private Sub txtcantidad2_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtcantidad2.TextChanged
txtsubtotal2.Text = Format(Val(txtcantidad2.Text) * datos2,
"##.000")
txtiva2.Text = Format((Val(txtsubtotal2.Text)) * 0.12,
"##.000")
txtvalor2.Text = Format((Val(txtsubtotal2.Text)) +
(Val(txtiva2.Text)))
End Sub
Private Sub txtcantidad3_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtcantidad3.TextChanged
36 FCHE DIEGO CHICAIZA
37. PROGRAMACION I U.T.A 5to “U”
txtsubtotal3.Text = Format(Val(txtcantidad3.Text) * datos3,
"##.000")
txtiva3.Text = Format((Val(txtsubtotal3.Text)) * 0.12,
"##.00")
txtvalor3.Text = Format((Val(txtsubtotal3.Text)) +
(Val(txtiva3.Text)))
End Sub
Private Sub txtcantidad4_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtcantidad4.TextChanged
txtsubtotal4.Text = Format((Val(txtcantidad4.Text) * datos4),
"##.000")
txtiva4.Text = Format(((Val(txtsubtotal4.Text)) * 0.12),
"##.000")
txtvalor4.Text = Format((Val(txtsubtotal4.Text)) +
(Val(txtiva4.Text)))
End Sub
Private Sub txtcantidad5_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtcantidad5.TextChanged
txtsubtotal5.Text = Format((Val(txtcantidad5.Text) * datos5),
"##.000")
txtiva5.Text = Format((Val(txtsubtotal5.Text) * 0.12),
"##.000")
txtvalor5.Text = Format((Val(txtiva5.Text)) +
(Val(txtsubtotal5.Text)))
End Sub
Private Sub txtcantidad6_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtcantidad6.TextChanged
txtsubtotal6.Text = Format((Val(txtcantidad6.Text) * datos6),
"##.00")
txtiva6.Text = Format((Val(txtsubtotal6.Text) * 0.12),
"##.000")
txtvalor6.Text = Format((Val(txtsubtotal6.Text)) +
(Val(txtiva6.Text)), "##.000")
txtcancelar.Text = Format(((Val(txtvalor1.Text)) +
(Val(txtiva1.Text))) + ((Val(txtvalor2.Text)) + (Val(txtiva2.Text))) +
((Val(txtvalor3.Text)) + (Val(txtiva3.Text))) + ((Val(txtvalor4.Text))
+ (Val(txtiva4.Text))) + ((Val(txtvalor5.Text)) + (Val(txtiva5.Text)))
+ ((Val(txtvalor6.Text)) + (Val(txtiva6.Text))), "##.000")
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CheckBox1.CheckedChanged
CheckBox1.Text = Format((Val(txtcancelar.Text)) +
(Val(txtcancelar.Text)) * 0.15, "##.000")
If CheckBox1.Checked = True Then
CheckBox2.Enabled = False
ElseIf CheckBox1.Checked = False Then
CheckBox2.Enabled = True
CheckBox1.Enabled = False
End If
End Sub
37 FCHE DIEGO CHICAIZA
38. PROGRAMACION I U.T.A 5to “U”
Private Sub CheckBox2_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CheckBox2.CheckedChanged
CheckBox2.Text = Format((Val(txtcancelar.Text)) -
(Val(txtcancelar.Text)) * 0.2, "##.000")
If CheckBox2.Checked = True Then
CheckBox1.Enabled = False
ElseIf CheckBox2.Checked = False Then
CheckBox1.Enabled = True
CheckBox2.Enabled = True
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
txtcantidad1.Text = ""
txtcantidad2.Text = ""
txtcantidad3.Text = ""
txtcantidad4.Text = ""
txtcantidad5.Text = ""
txtcantidad6.Text = ""
txtsubtotal1.Text = ""
txtsubtotal2.Text = ""
txtsubtotal3.Text = ""
txtsubtotal4.Text = ""
txtsubtotal5.Text = ""
txtsubtotal6.Text = ""
txtvalor1.Text = ""
txtvalor2.Text = ""
txtvalor3.Text = ""
txtvalor4.Text = ""
txtvalor5.Text = ""
txtvalor6.Text = ""
txtiva1.Text = ""
txtiva2.Text = ""
txtiva3.Text = ""
txtiva4.Text = ""
txtiva5.Text = ""
txtiva6.Text = ""
txtcancelar.Text = ""
txtunitario1.Text = ""
txtunitario2.Text = ""
txtunitario3.Text = ""
txtunitario4.Text = ""
txtunitario5.Text = ""
txtunitario6.Text = ""
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Me.Hide()
Form1.Show()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
End
End Sub
38 FCHE DIEGO CHICAIZA
39. PROGRAMACION I U.T.A 5to “U”
Private Sub txtcancelar_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtcancelar.TextChanged
End Sub
End Class
EJECUCION DEL PROGRAMA.
Esta es la imagen cuando hayamos ingresado los datos requeridos.
EJERCICIO 9
39 FCHE DIEGO CHICAIZA
40. PROGRAMACION I U.T.A 5to “U”
EL SISTEMA SOLAR
Tema:
Diseñe una aplicación que me permita conocer y obtener información de los planetas
del sistema solar.
Primeramente debemos crear una aplicación de Windows Forms
El Sistema Solar, vamos a agregarle una primera pantalla de presentación con distintos
botones o labels que nos vinculan a los otros formularios:
Utilizaremos un label.
Label1= Sistema solar.
Utilizaremos un combobox.
Combobox1
Utilizaremos un picturebox.
Picturebox1
Utilizaremos un textbox.
Textbox1
CODIFICACIÓN DEL PROGRAMA.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("MERCURIO")
ComboBox1.Items.Add("VENUS")
ComboBox1.Items.Add("TEIRRA")
ComboBox1.Items.Add("JUPITER")
ComboBox1.Items.Add("SATURNO")
ComboBox1.Items.Add("URANO")
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
Select Case (ComboBox1.SelectedIndex)
Case Is = 0
TextBox1.Text = " Mercurio es el planeta del Sistema
Solar más próximo al Sol y el más pequeño.Antiguamente se pensaba que
Mercurio siempre presentaba la misma cara al Sol, Al ser un planeta
cuya órbita es inferior a la de la Tierra, Mercurio periódicamente
pasa delante del Sol, fenómeno que se denomina tránsito astronómico
(ver tránsito de Mercurio). Observaciones de su órbita a través de
muchos años demostraron que el perihelio gira 43 de arco más por siglo
de lo predicho por la mecánica clásica de Newton. Esta discrepancia
llevó a un astrónomo francés, Urbain Le Verrier, a pensar que existía
un planeta aún más cerca del Sol, al cual llamaron Vulcano, que
perturbaba la órbita de Mercurio. Ahora se sabe que Vulcano no existe;
40 FCHE DIEGO CHICAIZA
41. PROGRAMACION I U.T.A 5to “U”
la explicación correcta del comportamiento del perihelio de Mercurio
se encuentra en la Teoría General de la Relatividad."
PictureBox1.Load("C:UsersLab6DesktopPLANETASMERCURIO.jpg")
PictureBox2.Image = ImageList1.Images(0)
Case Is = 1
TextBox1.Text = " Venus recibe su nombre en honor a
Venus, la diosa romana del amor. La órbita de Venus es una elipse con
una excentricidad de menos del 1%, formando la órbita más circular de
todos los planetas; apenas supera la de Neptuno. Su presión
atmosférica es 90 veces superior a la terrestre; es por tanto la mayor
presión atmosférica de todos los planetas rocosos"
PictureBox1.Load("C:UsersLab6DesktopPLANETASVENUS.jpg")
PictureBox2.Image = ImageList1.Images(1)
Case Is = 2
TextBox1.Text = ("La Tierra se formó hace
aproximadamente 4567 millones de años y la vida surgió unos mil
millones de años después.17 Es el hogar de millones de especies,
incluyendo los seres humanos y actualmente el único cuerpo astronómico
donde se conoce la existencia de vida.18 La atmósfera y otras
condiciones abióticas han sido alteradas significativamente por la
biosfera del planeta, favoreciendo la proliferación de organismos
aerobios, así como la formación de una capa de ozono que junto con el
campo magnético terrestre bloquean la radiación solar dañina,
permitiendo así la vida en la Tierra.19 Las propiedades físicas de la
Tierra, la historia geológica y su órbita han permitido que la vida
siga existiendo. Se estima que el planeta seguirá siendo capaz de
sustentar vida durante otros 500 millones de años, ya que según las
previsiones actuales, pasado ese tiempo la creciente luminosidad del
Sol terminará causando la extinción de la biosfera.20 21")
PictureBox1.Load("C:UsersLab6DesktopPLANETASTIERRA.jpg")
PictureBox2.Image = ImageList1.Images(2)
Case Is = 3
TextBox1.Text = ("Júpiter es el quinto planeta del
Sistema Solar. Forma parte de los denominados planetas exteriores o
gaseosos. Recibe su nombre del dios romano Júpiter (Zeus en la
mitología griega). Se trata del planeta que ofrece un mayor brillo a
lo largo del año dependiendo de su fase. Es, además, después del Sol,
el mayor cuerpo celeste del Sistema Solar, con una masa casi dos veces
y media la de los demás planetas juntos (con una masa 318 veces mayor
que la de la Tierra y 3 veces mayor que la de Saturno).")
PictureBox1.Load("C:UsersLab6DesktopPLANETASJUPITER.jpg")
PictureBox2.Image = ImageList1.Images(3)
Case Is = 4
TextBox1.Text = ("Saturno es el sexto planeta del
Sistema Solar, el segundo en tamaño y masa después de Júpiter y el
único con un sistema de anillos visible desde nuestro planeta. Su
nombre proviene del dios romano Saturno. Forma parte de los
denominados planetas exteriores o gaseosos, también llamados jovianos
por su parecido a Júpiter. El aspecto más característico de Saturno
son sus brillantes anillos. Antes de la invención del telescopio,
Saturno era el más lejano de los planetas conocidos y, a simple vista,
no parecía luminoso ni interesante. El primero en observar los anillos
fue Galileo en 1610,1 pero la baja inclinación de los anillos y la
baja resolución de su telescopio le hicieron pensar en un principio
que se trataba de grandes lunas. Christiaan Huygens con mejores medios
de observación pudo en 1659 observar con claridad los anillos. James
Clerk Maxwell en 1859 demostró matemáticamente que los anillos no
41 FCHE DIEGO CHICAIZA
42. PROGRAMACION I U.T.A 5to “U”
podían ser un único objeto sólido sino que debían ser la agrupación de
millones de partículas de menor tamaño. Las partículas que habitan en
los anillos de Saturno giran a una velocidad de 48 000 km/h, 15 veces
más rápido que una bala.")
PictureBox1.Load("C:UsersLab6DesktopPLANETASSATURNO.jpg")
PictureBox2.Image = ImageList1.Images(4)
Case Is = 5
TextBox1.Text = ("Urano es el séptimo planeta del
Sistema Solar, el tercero en cuanto a mayor tamaño,Sir William
Herschel anunció su descubrimiento el 13 de marzo de 1781, ampliando
las fronteras conocidas del Sistema Solar hasta entonces por primera
vez en la historia moderna. Urano es también el primer planeta
descubierto por medio de un telescopio.Urano es similar en composición
a Neptuno, y los dos tienen una composición diferente de los otros dos
gigantes gaseosos (Júpiter y Saturno). Por ello, los astrónomos a
veces los clasifican en una categoría diferente, los gigantes helados.
La atmósfera de Urano, aunque es similar a la de Júpiter y Saturno por
estar compuesta principalmente de hidrógeno y helio, contiene una
proporción superior tanto de «hielos»nota 4 como de agua, amoníaco y
metano, junto con trazas de hidrocarburos.12 nota 5 Posee la atmósfera
planetaria más fría del Sistema Solar, con una temperatura mínima de
49 K (-224 °C). Asimismo, tiene una estructura de nubes muy compleja,
acomodada por niveles, donde se cree que las nubes más bajas están
compuestas de agua y las más altas de metano.12 En contraste, el
interior de Urano se encuentra compuesto principalmente de hielo y
roca.")
PictureBox1.Load("C:UsersLab6DesktopPLANETASURANO.jpg")
PictureBox2.Image = ImageList1.Images(5)
End Select
End Sub
End Class
IMÁGENES DE LA EJECUCION DEL PROGRAMA.
Escojemos la opcion que deseamos.
42 FCHE DIEGO CHICAIZA
43. PROGRAMACION I U.T.A 5to “U”
CONCLUSION.
El textbox puede ser acoplado al tecto que ingresamos a la codificacion es una
herramienta muy útil para textos largos.
EJERCICIO 10
PROPIEDADES ALIMENTICIAS
Diseñar un formulario que me permita visualizar las propiedades alimenticias utilizando
la herramienta checkbox e imagelist para visualizar las imágenes y una descripcion de
ellas.
Este programa nos permite conocer algunas de las propiedades alimenticias y nos
muestra una imagen que la identifica.
Utilizaremos los siguientes label.
Label1: Para el Título.
Label2: Para el Subtítulo.
Label3: Para la descripcion de cada opcion de la lista.
Utilizaremos un CheckBox
CheckBox: Para desplegar la lista de opcines.
Utilizaremos los PictureBox
PictureBox1: Para visualizar la 1ª imagen realizada con el case.
PictureBox2: Para visualizar la 2ª imagen realizada con la Herramienta
ImageList.
Utilizaremos un Button
43 FCHE DIEGO CHICAIZA
44. PROGRAMACION I U.T.A 5to “U”
Button: Para finalizar el programa.
CODIFICACION DEL PROGRAMA.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
i.Items.Add("Cereales y tubérculos")
i.Items.Add("Verduras y hortalizas")
i.Items.Add("Leguminosas y alimentos de origen animal")
i.Items.Add("Grasas y azúcares")
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
i.SelectedIndexChanged
Select Case (i.SelectedIndex)
Case Is = 0
TextBox1.Text = "En el primer nivel de la pirámide se
encuentra el 60% de lo que consumimos diariamente en mayor cantidad,
rico en carbohidratos que aportan gran energía."
PictureBox1.Load("H:QUINTO INFORMATICALOGICA DE
PROGRAMACION IEJERCICIOS DE
PROGRAMACIONalimentosimagenescereales1.jpg")
PictureBox2.Image = ImageList1.Images(0)
Case Is = 1
TextBox1.Text = "Este es el segundo nivel en la
pirámide, las verduras y hortalizas nos proveen gran cantidad de
vitaminas y fibras (lo que nos facilita el tránsito intestinal)."
PictureBox1.Load("H:QUINTO INFORMATICALOGICA DE
PROGRAMACION IEJERCICIOS DE
PROGRAMACIONalimentosimagenesverduras2.jpg")
PictureBox2.Image = ImageList1.Images(1)
Case Is = 2
TextBox1.Text = "Este grupo nos provee proteínas, lo
cual ayuda a tener un cuerpo fuerte y sano. Se recomienda el consumo
de pescado así como carnes blancas (conejo o aves) por su bajo
contenido en grasa. Las carnes aportan gran cantidad de proteínas y es
recomendable para una buena alimentación."
PictureBox1.Load("H:QUINTO INFORMATICALOGICA DE
PROGRAMACION IEJERCICIOS DE
PROGRAMACIONalimentosimagenesleguminosas1.jpg")
PictureBox2.Image = ImageList1.Images(2)
Case Is = 3
TextBox1.Text = "Si bien es cierto son necesarios
porque proporcionan mucha energía, sin embargo se recomienda un
consumo moderado por su alto contenido en colesterol, ellos forman la
punta de la pirámide."
PictureBox1.Load("H:QUINTO INFORMATICALOGICA DE
PROGRAMACION IEJERCICIOS DE
PROGRAMACIONalimentosimagenesgrasas1.jpg")
PictureBox2.Image = ImageList1.Images(3)
End Select
End Sub
End Class
44 FCHE DIEGO CHICAIZA
45. PROGRAMACION I U.T.A 5to “U”
IMÁGENES DE LA EJECUCION DEL PROGRAMA.
Ahora escojemos el tipo de alimento que deseamos saber que vitaminas contienen.
45 FCHE DIEGO CHICAIZA
46. PROGRAMACION I U.T.A 5to “U”
EJERCICIO11
PLANILLA DE LUZ
Diseñe un proyecto que permita calcular la planilla de Luz eléctrica según los
siguientes condicionamientos.
Valide el ingreso de los datos en las cajas de texto de tal manera que solo
permita el ingreso de números
Valide los datos de la Lectura anterior y la Lectura actual de tal manera que la
lectura actual es siempre mayor que la lectura anterior
Se ingresan solo las lecturas anterior y actual y se genera automáticamente el
Total a Pagar
Proponga su propio diseño
La aplicación se genera n veces según lo decida el usuario
Programe todos los botones que considere necesarios
DESCRIPCIÓN
Este programa nos permite calcular el valor de consumo de luz eléctrica según los watts
consumidos y los recargos por alumbrado público, bomberos, y basura.
14 Label
46 FCHE DIEGO CHICAIZA
47. PROGRAMACION I U.T.A 5to “U”
Label 1 = EMPRESA ELECTRICA
Label 2 = Fecha
Label 3 = # Cuenta
Label 4 = Factura
Label 5 = Cliente
Label 6 = Lectura actual
Label 7 = Lectura anterior
Label 8 = Wat
Label 9 = RECARGOS
Label 10 = 3% Alumbrado P.
Label 11 = 4% Bomberos
Label 12 = 5% Basura
Label 13 = Total
Label 14 = Costo
12 Text Box
Text Box 1 para la fecha.
Text Box 2 para el # de Cuenta.
Text Box 3 para la factura.
Text Box 4 = txtcliente
Text Box 5 = txtanterior
Text Box 6 = txtactual
Text Box 7 = txtconsumo
Text Box 8 = txtacosto
Text Box 9 = txtalumbrado
Text Box 10 = txtbomberos
Text Box 11 = txtbasura
Text Box 12 = txttotal
CODIFICACION DEL PROGRAMA.
Public Class Form1
Private Sub txtcliente_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtcliente.KeyPress
If Char.IsLetter(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsSeparator(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtactual_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtactual.Click
If Val(txtactual.Text) > Val(txtanterior.Text) Then
txtconsumo.Text = Val(txtactual.Text) -
Val(txtanterior.Text)
Else
txtactual.Clear()
txtactual.Focus()
47 FCHE DIEGO CHICAIZA
48. PROGRAMACION I U.T.A 5to “U”
End If
txtcosto.Text = Val(txtconsumo.Text) * 0.09
txtalumbrado.Text = Val(txtcosto.Text) * 0.03
txtbomberos.Text = Val(txtcosto.Text) * 0.04
txtbasura.Text = Val(txtcosto.Text) * 0.05
txttotal.Text = Val(txtcosto.Text) + Val(txtalumbrado.Text) +
Val(txtbomberos.Text) + Val(txtbasura.Text)
End Sub
Private Sub txtactual_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtactual.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtanterior_KeyPress(ByVal sender As Object, ByVal e
As System.Windows.Forms.KeyPressEventArgs) Handles
txtanterior.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
End Class
EMAGENES DE LA EJECUCION DEL PROGRAMA.
48 FCHE DIEGO CHICAIZA
49. PROGRAMACION I U.T.A 5to “U”
Ingresamos los datos correspondientes.
EJERCICIO 12
ROL DE PAGOS.
Diseñe un programa que me permita visualizar un rol de pagos de una empresa.
Para el diseño del rol de pagos utilizaremos los siguientes componentes.
Utilizaremos form.
form1= para el rol de pagos
form2= para ingresar la clave del usuario
Utilizaremos los picturebox
picturebox1 = para poner una imagen en el form2 para la clave
Utilizaremos los label
cantidad 28
49 FCHE DIEGO CHICAIZA
50. PROGRAMACION I U.T.A 5to “U”
Utilizaremos los textbox.
textbox1= para ingresar el nombre del usuario
textbox2= para ingresar la ocntraseña del usuario
textbox3= para ingresar la cedula del empleado
textbox4= para ingresar el nombre del cargo
textbox5= para ingresar el telefono
textbox6= para ingresar el sueldo
textbox7= para ingresar la direccion
textbox8= para ingresar el iess
textbox9= para ingresar las multas
textbox10= para ingresar el telefono
textbox11=para calcular el descuento de las multas
textbox12=para ingresar el numero de las horas extras
textbox13=para calcular el total de las horas extras
textbox14=para ingresar el numero de cargo familiar
textbox15=para calcular el total de el cargo familiar
textbox16=para calcular el total de ingresos
textbox17=el total de egresos
textbox18=total a recibir
Utilizaremos unos button
button1 = para ingresar al siguiente formulario
button2= para calcular total de ingresos
button3 = para calcular total de egresos
button4= para iniciar otra persona
button5=para borrar y ingresar un nuevo datos
button6= para salir de la ejecucion
Utilizaremos un chekbox
chekbox 1 = para seleccionar si tiene prestamo o no
CODIFICACION DEL PROGRAMA.
Public Class Form1
Dim DATOS, aux, con As Integer
Dim DATOS1 As Double
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
DATOS = ComboBox1.SelectedIndex
If (DATOS = 0) Then
txtcedula.Text = "1804758963"
txtcargo.Text = "GERENTE"
txtsueldo.Text = Val("400")
'PictureBox1.Load("C:ROL_PAGOSgerente.jpg")
50 FCHE DIEGO CHICAIZA
52. PROGRAMACION I U.T.A 5to “U”
DATOS1 = txtsueldo.Text
End If
End Sub
Private Sub txtdirec_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtdirec.KeyPress
If Char.IsLetter(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsSeparator(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txttele_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txttele.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtextras_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtextras.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txttofami_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txttofami.TextChanged
End Sub
Private Sub txtextras_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtextras.TextChanged
If Val(txtextras.Text) >= 1 And Val(txtextras.Text) <= 10 Then
aux = Val(txtsueldo.Text) * 6 / 100
txthextras.Text = Val(txtextras.Text) * aux
Else
MsgBox("Numero Invalido")
52 FCHE DIEGO CHICAIZA
53. PROGRAMACION I U.T.A 5to “U”
End If
End Sub
Private Sub txtfami_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtfami.TextChanged
If Val(txtfami.Text >= 2) Then
txttofami.Text = Format(Val(txtfami.Text) * 10.5,
"###.00")
Else
txttofami.Text = Format(Val(txtfami.Text) * 15.5,
"###.00")
End If
End Sub
Private Sub TextBox1_TextChanged_1(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtmultas.TextChanged
If Val(txttomultas.Text) >= 7 Then
txttomultas.Text = Val(txtsueldo.Text) * 20 / 100
Else
txttomultas.Text = Val(txtmultas.Text) * 3
End If
End Sub
Private Sub TextBox1_TextChanged_2(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtprestamos.TextChanged
If Val(txtprestamos.Text) = 6 Then
con = Val(txtmonto.Text) * 8 / 100
txtvalpresta.Text = Format((Val(txtmonto.Text) + con) / 6,
"###.00")
ElseIf Val(txtprestamos.Text) = 12 Then
con = (Val(txtmonto.Text) * 16 / 100)
txtvalpresta.Text = Format((Val(txtmonto.Text) + con) /
12, "###.00")
ElseIf Val(txtprestamos.Text) = 18 Then
con = (Val(txtmonto.Text) * 20 / 100)
txtvalpresta.Text = Format((Val(txtmonto.Text) + con) /
18, "###.00")
End If
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CheckBox1.CheckedChanged
txtprestamos.Visible = True
txtmonto.Visible = True
txtvalpresta.Visible = True
End Sub
Private Sub txtsueldo_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtsueldo.TextChanged
txtiees.Text = Format(Val(txtsueldo.Text) * 11.5 / 100,
"###.00")
End Sub
53 FCHE DIEGO CHICAIZA
54. PROGRAMACION I U.T.A 5to “U”
Private Sub txttorecibe_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txttorecibe.Click
txttorecibe.Text = Format(Val(txtingres.Text) -
Val(txtegresos.Text), "##.00")
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
End
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Form2.Show()
Me.Hide()
End Sub
Private Sub txtegresos_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtegresos.TextChanged
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
txtegresos.Text = Format(Val(txtiees.Text) +
Val(txttomultas.Text) + Val(txtvalpresta.Text), "###.00")
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button4.Click
txtingres.Text = Format(Val(txtsueldo.Text) +
Val(txthextras.Text) + Val(txttofami.Text), "##.00")
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button5.Click
txtdirec.Text = ""
txttele.Text = ""
txtingres.Text = ""
txtegresos.Text = ""
txtiees.Text = ""
txtmonto.Text = ""
txtprestamos.Text = ""
txtmultas.Text = ""
txttomultas.Text = ""
txtcargo.Text = ""
txttofami.Text = ""
txtsueldo.Text = ""
txtcargo.Text = ""
54 FCHE DIEGO CHICAIZA
55. PROGRAMACION I U.T.A 5to “U”
txtfami.Text = ""
txtextras.Text = ""
txttorecibe.Text = ""
txtsueldo.Text = ""
txthextras.Text = ""
txtvalpresta.Text = ""
txttorecibe.Text = ""
End Sub
End Class
IMAGENS DE LA EJECUCION DELPROGRAMA.
55 FCHE DIEGO CHICAIZA
56. PROGRAMACION I U.T.A 5to “U”
Ahora ingresamos los datos correspondientes.
EJERCICIO 13
SISTEMA DE CONTROL DE MATRICULAS.
Elaborar un programa que me permita realizar el ingreso de los datos de un estudiante al
sistema de matrículas, donde se me detalle los colegios y el tipo fiscal o particular, y se
me visualice el valor de la matrícula, servicio médico, internet y recreación, y el valor
total a pagar.
Descripción del ejercicio
En este ejercicio para el sistema de matrícula se desea ingresar los datos del estudiante y
poder seleccionar un colegio y el tipo ya sea fiscal, particular o fiscomisional.
También se bloquea los textbox donde se nos visualiza los valores de los seguros y el
total.
Objetos
1splitContainer
Utilizaremos los label.
Label1=sistema de recaudacion
Label2=datos personales
Label3=nombre
Label4=apellido
Label5=cedula
56 FCHE DIEGO CHICAIZA
57. PROGRAMACION I U.T.A 5to “U”
Label6=direccion
Label7=telefono
Label8=datos de matricula
Label9=valor matricula
Label10=servicio medico
Label11=servicio internet
Label12=servicio recreacion
Label13=total a pagar
Label14=tipo
Label15=colegio
Utilizaremos los textbox.
Textbox1=txtnombre
Textbox2=txtapellido
Textbox3=txtcedula
Textbox4=txtdireccion
Textbox5=txttelefono
Textbox6= txtvmatricula
Textbox7= txtsmedico
Textbox8= txtsinternet
Textbox9= txtsrecreacion
Textbox10= txttotal
Utilizaremos dos button
Button1=salir
Button2=nuevo
Utilizaremos dos Combobox
Combobox1=cmbcolegio
Combobox1=cmbtipo
CODIFICACION DEL PROGRAMA.
Public Class Form1
Dim dato As Integer
Private Sub NOMBRE_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles NOMBRE.KeyPress
If Char.IsNumber(e.KeyChar) Then
e.Handled = True
MsgBox("NO DATOS NUMERICOS")
NOMBRE.Focus()
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
57 FCHE DIEGO CHICAIZA
58. PROGRAMACION I U.T.A 5to “U”
e.Handled = False
End If
End Sub
Private Sub APELLIDO_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles APELLIDO.KeyPress
If Char.IsNumber(e.KeyChar) Then
e.Handled = True
MsgBox("NO DATOS NUMERICOS")
APELLIDO.Focus()
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = False
End If
End Sub
Private Sub CEDULA_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles CEDULA.KeyPress
If Char.IsLetter(e.KeyChar) Then
e.Handled = False
MsgBox("SOLO DATOS NUMERICOS")
CEDULA.Focus()
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = False
End If
End Sub
Private Sub TELEFONO_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TELEFONO.KeyPress
If Char.IsLetter(e.KeyChar) Then
e.Handled = False
MsgBox("SOLO DATOS NUMERICOS")
TELEFONO.Focus()
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = False
End If
End Sub
Private Sub VMATRICULA_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles VMATRICULA.TextChanged
End Sub
58 FCHE DIEGO CHICAIZA
59. PROGRAMACION I U.T.A 5to “U”
IMÁGENES DE LA EJECUCION DEL PROGRAMA.
Ingresamos los datos requeridos.
59 FCHE DIEGO CHICAIZA
60. PROGRAMACION I U.T.A 5to “U”
EJERCICIO 14
CONTROL DE NOTAS DE ESTUDIANTES.
Diseñe un programa que me permita visualizar un control de notas con su respectiva
equivalencia.
Diseño del proyecto.
Utilizaremos un form
Form1
Utilizaremos los textbox.
Textbox1
Txtnota1
Txtnota2
Txtnota3
Txtnota4
Txtnota5
Txtnota6
Txtnota7
Txtnota8
Txtnota9
Txtnota10
Txtnota11
Txtnota12
Txtnota13
Txtnota14
Txtnota15
Txtnota16
Txtnota17
Txtnota18
Txtpromedio1
Txtpromedio2
Txtpromedio3
Txtpromedio4
Txtpromedio5
Txtpromedio6
Txtequivalencia1
Txtequivalencia2
Txtequivalencia3
Txtequivalencia4
Txtequivalencia5
60 FCHE DIEGO CHICAIZA
61. PROGRAMACION I U.T.A 5to “U”
Txtequivalencia6
Utilizaremos los label.
Label1= Nombre
Label2= Semestre
Label3= Paralelo
Label4= Promedio
Label5= Equivalencia
Label6= Materia.
Label7
Label8
Label9
Label10
Label11
Label12=Promedio general
Label13= Equivalencia
Utilizaremos un button.
Button1=Verificar.
CODIFICACION DEL PROGRAMA.
Public Class Form1
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbsemestre.SelectedIndexChanged
Select Case (cmbsemestre.SelectedIndex)
Case Is = 0
lblmateria1.Text = "TRABAJO EN EQUIPO"
lblmateria2.Text = "INVESTIGACION"
lblmateria3.Text = "FISICA II"
lblmateria4.Text = "PROGRAMACION I"
lblmateria5.Text = "MATEMATICAS II"
lblmateria6.Text = "REALIDAD NACIONAL"
Case Is = 1
lblmateria1.Text = "PSICOLOGIA I"
lblmateria2.Text = "MATEMATICAS III"
lblmateria3.Text = "CIRCUITOS ELECTRICOS"
lblmateria4.Text = "MODELOS PEDAGOGICOS"
lblmateria5.Text = "PROGRAMACION II"
lblmateria6.Text = "TUTORIAS"
Case Is = 2
lblmateria1.Text = "PROBLEMAS DEL APRENDIZAJE"
lblmateria2.Text = "AQUITECTURA COMPU. II"
lblmateria3.Text = "GESTOR CENTROS COMPU."
lblmateria4.Text = "LOGICA PROG. I"
lblmateria5.Text = "PLANIFICACION CURRICULAR"
lblmateria6.Text = "HERRAMIENTAS MULTIMEDIA"
Case Is = 3
lblmateria1.Text = "PRACTICAS PREPROFESIONALES"
lblmateria2.Text = "SISTEMAS OPERATIVOS"
61 FCHE DIEGO CHICAIZA
62. PROGRAMACION I U.T.A 5to “U”
lblmateria3.Text = "PROGRAMACION WEB I"
lblmateria4.Text = "GESTION DE PROYECTOS"
lblmateria5.Text = "SISTEMATIZACION CONTABLE"
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
cmbsemestre.Items.Add("SEGUNDO SEMESTRE")
cmbsemestre.Items.Add("TERCER SEMESTRE")
cmbsemestre.Items.Add("QUINTO SEMESTRE")
cmbsemestre.Items.Add("SEPTIMO SEMESTRE")
ComboBox2.Items.Add("A")
ComboBox2.Items.Add("B")
ComboBox2.Items.Add("UNICO")
ComboBox2.Items.Add("UNICO")
End Sub
Private Sub txtnota3_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota3.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota3_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota3.TextChanged
If txtnota3.Text < 1 Or txtnota3.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
txtpromedio1.Text = Format(((Val((txtnota1.Text) +
(Val(txtnota2.Text)) + (Val(txtnota3.Text)))) / 3), "##.000")
If (Val(txtpromedio1.Text)) >= 7 Then
txtequivalencia1.Text = "APROBADO"
ElseIf (Val(txtpromedio1.Text)) >= 5 And
(Val(txtpromedio1.Text)) < 7 Then
txtequivalencia1.Text = "SUSPENSO"
ElseIf (Val(txtpromedio1.Text)) < 5 Then
txtequivalencia1.Text = "REPROBADO"
End If
End Sub
Private Sub txtnota6_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota6.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota6_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota6.TextChanged
If txtnota6.Text < 1 Or txtnota6.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
62 FCHE DIEGO CHICAIZA
63. PROGRAMACION I U.T.A 5to “U”
txtpromedio2.Text = Format(((Val((txtnota4.Text)) +
(Val(txtnota5.Text)) + (Val(txtnota6.Text)))) / 3, "##.000")
If (Val(txtpromedio2.Text)) >= 7 Then
txtequivalencia2.Text = "APROBADO"
ElseIf (Val(txtpromedio2.Text)) >= 5 And
(Val(txtpromedio2.Text)) < 7 Then
txtequivalencia2.Text = "SUSPENSO"
ElseIf (Val(txtpromedio1.Text)) < 5 Then
txtequivalencia2.Text = "REPROBADO"
End If
End Sub
Private Sub txtnota9_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota9.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota9_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota9.TextChanged
If txtnota9.Text < 1 Or txtnota9.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
txtpromedio3.Text = Format(((Val((txtnota7.Text)) +
(Val(txtnota8.Text)) + (Val(txtnota9.Text)))) / 3, "##.000")
If (Val(txtpromedio3.Text)) >= 7 Then
txtequivalencia3.Text = "APROBADO"
ElseIf (Val(txtpromedio3.Text)) >= 5 And
(Val(txtpromedio3.Text)) < 7 Then
txtequivalencia3.Text = "SUSPENSO"
ElseIf (Val(txtpromedio3.Text)) < 5 Then
txtequivalencia3.Text = "REPROBADO"
End If
End Sub
Private Sub txtnota12_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota12.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota12_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota12.TextChanged
If txtnota12.Text < 1 Or txtnota12.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
txtpromedio4.Text = Format(((Val((txtnota10.Text)) +
(Val(txtnota11.Text)) + (Val(txtnota12.Text)))) / 3, "##.000")
If (Val(txtpromedio4.Text)) >= 7 Then
txtequivalencia4.Text = "APROBADO"
63 FCHE DIEGO CHICAIZA
64. PROGRAMACION I U.T.A 5to “U”
ElseIf (Val(txtpromedio4.Text)) >= 5 And
(Val(txtpromedio4.Text)) < 7 Then
txtequivalencia4.Text = "SUSPENSO"
ElseIf (Val(txtpromedio4.Text)) < 5 Then
txtequivalencia4.Text = "REPROBADO"
End If
End Sub
Private Sub txtnota15_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota15.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota15_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota15.TextChanged
If txtnota15.Text < 1 Or txtnota15.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
txtpromedio5.Text = Format(((Val((txtnota13.Text)) +
(Val(txtnota14.Text)) + (Val(txtnota15.Text)))) / 3, "##.000")
If (Val(txtpromedio5.Text)) >= 7 Then
txtequivalencia5.Text = "APROBADO"
ElseIf (Val(txtpromedio5.Text)) >= 5 And
(Val(txtpromedio5.Text)) < 7 Then
txtequivalencia5.Text = "SUSPENSO"
ElseIf (Val(txtpromedio5.Text)) < 5 Then
txtequivalencia5.Text = "REPROBADO"
End If
End Sub
Private Sub txtnota18_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota18.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota18_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota18.TextChanged
If txtnota18.Text < 1 Or txtnota18.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
txtpromedio6.Text = Format(((Val((txtnota16.Text)) +
(Val(txtnota17.Text)) + (Val(txtnota18.Text)))) / 3, "##.000")
If (Val(txtpromedio6.Text)) >= 7 Then
txtequivalencia6.Text = "APROBADO"
ElseIf (Val(txtpromedio6.Text)) >= 5 And
(Val(txtpromedio6.Text)) < 7 Then
txtequivalencia6.Text = "SUSPENSO"
ElseIf (Val(txtpromedio6.Text)) < 5 Then
txtequivalencia6.Text = "REPROBADO"
64 FCHE DIEGO CHICAIZA
65. PROGRAMACION I U.T.A 5to “U”
End If
End Sub
Private Sub txtpromedio6_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtpromedio6.TextChanged
End Sub
Private Sub txtnota1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota1.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota1_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota1.TextChanged
If txtnota1.Text < 1 Or txtnota1.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub txtnota2_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota2.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota2_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota2.TextChanged
If txtnota2.Text < 1 Or txtnota2.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub txtnota4_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota4.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota4_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota4.TextChanged
If txtnota4.Text < 1 Or txtnota4.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
65 FCHE DIEGO CHICAIZA
66. PROGRAMACION I U.T.A 5to “U”
Private Sub txtnota5_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota5.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota5_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota5.TextChanged
If txtnota5.Text < 1 Or txtnota5.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub txtnota7_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota7.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota7_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota7.TextChanged
If txtnota7.Text < 1 Or txtnota7.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub txtnota8_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota8.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = True
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota8_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota8.TextChanged
If txtnota8.Text < 1 Or txtnota8.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub txtnota10_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota10.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
66 FCHE DIEGO CHICAIZA
67. PROGRAMACION I U.T.A 5to “U”
e.Handled = True
End If
End Sub
Private Sub txtnota10_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota10.TextChanged
If txtnota10.Text < 1 Or txtnota10.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub txtnota11_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota11.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota11_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota11.TextChanged
If txtnota11.Text < 1 Or txtnota11.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub txtnota13_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota13.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota13_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota13.TextChanged
If txtnota13.Text < 1 Or txtnota13.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub txtnota14_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota14.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota14_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota14.TextChanged
If txtnota14.Text < 1 Or txtnota14.Text > 10 Then
67 FCHE DIEGO CHICAIZA
68. PROGRAMACION I U.T.A 5to “U”
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub txtnota16_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota16.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota16_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota16.TextChanged
If txtnota16.Text < 1 Or txtnota16.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub txtnota17_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnota17.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub txtnota17_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtnota17.TextChanged
If txtnota17.Text < 1 Or txtnota17.Text > 10 Then
MsgBox("INGRESE NUEVAMENTE EL NUMERO")
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
txtpgeneral.Text = Format(((Val(txtpromedio1.Text) +
Val(txtpromedio2.Text) + Val(txtpromedio3.Text) +
Val(txtpromedio4.Text) + Val(txtpromedio5.Text) +
Val(txtpromedio6.Text)) / 6), "##.000")
End Sub
End Class
68 FCHE DIEGO CHICAIZA
69. PROGRAMACION I U.T.A 5to “U”
IMÁGENES DE LA EJECUCION DEL PROGRAMA.
Ingresamos los datos necesarios para la verificación del promedio y la equivalencia.
69 FCHE DIEGO CHICAIZA
70. PROGRAMACION I U.T.A 5to “U”
EJERCICIO 15
PRUEBA DEL PRIMER PARCIAL
1.- Abrir un nuevo proyecto en visual basic
2.-Apariencia del formulario
3.-Componentes
Utilizaremos la siguiente PictureBox
PictureBox1=imagen del auto
Utilizaremos 3 GroupBox
GroupBox1=Datos personales
GroupBox2=Datos del vehículo
GroupBox3=Valores totales
Utilizaremos 19 label.
Label1= Tema
Label2=Código
Label3= Nombre
Label4= Apellido
Label5=Cedula
Label6=Dirección
Label7=Teléfono
70 FCHE DIEGO CHICAIZA
71. PROGRAMACION I U.T.A 5to “U”
Label8=Tipo de vehículo
Label9=Valor
Label10=Color
Label11=Aire acondicionado
Label12= Vidrios eléctricos
Label13= Valor de venta
Label14=Comisión vendedor
Label15= Total comisión
Label16=Total a pagar
Utilizaremos los siguientes text box
Textbox1=txtnombres
Textbox2=txtapellido
Textbox3=txtcedula
Textbox4=txtdireccion
Textbox4=txttelefono
Textbox5=txttvehiculo
Textbox6=txtvalor
Textbox7=txtvalventa
Textbox8=txtcomvendedor
Textbox9=txttotcomision
Textbox10=txttotpagar
Utilizaremos los 5 combobox.
Combobox1= Para La Selección Del Código
Combobox2= Para La Selección Del Tipo De Vehículo
Combobox3= Para Seleccionar El Color Del Carro
Combobox4= Para La Selección Del Aire Acondicionado
Combobox5= Para La Selección De Vidrios Eléctricos
Utilizaremos 3 botones
Button1= Para Nuevo
Button2= Para Añadir Venta
Button3= Para Salir
4.-Codificacion
Public Class Form1
Dim a As Double
(CODIFICACION DEL PRIMER COMBOBOX)
71 FCHE DIEGO CHICAIZA