Elemento 3

111
RUTH NARANJO

description

Utilización de Estructuras de Control para la manipulación de información en Visual Basic.

Transcript of Elemento 3

Page 1: Elemento 3

RUTH NARANJO

Page 2: Elemento 3

ELEMENTO 3

Utilización de Estructuras de Control para la manipulación de información.

Objetivos

Manipulación y detalle de los argumentos de Estructuras de

control.

Manipulación y detalle de los argumentos Estructuras

condicionantes.

Manipulación y detalle de argumentos de Estructuras

repetitivas.

Manipulación y de talle de argumentos Estructuras selectivas

Manipulación y argumentos de funciones.

Page 3: Elemento 3

1. CARATULA

Enunciado:

Diseña una carátula con los sellos de la Universidad.

Descripción:

Este programa nos permite diseñar una carátula, utilizando Label y Picture Box.

Diseño:

Objetos:

1 FORM Form1

7 LABEL

Page 4: Elemento 3

Label 1 = Txtuniversidad = UNIVERSIDAD TÉCNICA DE AMBATO

Label 2 = Txtfacultad = FACULTAD CIENCIAS HUMANAS Y DE LA EDUCACIÓN

Label 3 = Txtcarrera = CARRERA DOCENCIA EN INFORMÁTICA

Label 4 = Txtnombre = Nombre

Label 5 = Txttutor = Tutor

Label 6 = Txtnom = Ruth Naranjo

Label 7 = Txting = Ing. Wilma Gavilánez

2 PICTURE BOX Picture Box 1 = para el sello Universidad.

Picture Box 2 = para el sello clase A.

2. DATOS PERSONALES

Enunciado:

Realice un programa que me permita ingresar los datos personales del usuario.

Descripción:

Este programa permite ingresar los datos de una persona n veces y visualizarlos como un mensaje.

Objetos:

2 FORM

Form1 = Bienvenidos

Form2 = Datos

FOM 1

Page 5: Elemento 3

1 LABEL

Label1 = BIENVENIDOS

1 PICTUREBOX

PictueBox1 = imagen de carita.

2 BUTTON

Button1 = cmddatos = DATOS

Button2 = cmdsalir = SALIR

FORM 2

Page 6: Elemento 3

5 LABEL

label1 = DATOS PERSONALES

label2 = Nombre

label3 = Apellido

label4 = Edad

3 TEXTBOX

TextBox1 = Txtnombre = Nombre

TextBox2 = Txtxapellido = Apellido

TextBox3 = Txtedad= Edad

2 BUTTON Button1 = Cmdingresar = INGRESAR

Button2 = Cmdnuevo = NUEVO

Button3 = Cmdregresar = REGRESAR

Código:

FORMULARIO 1

Programamos para que aparezca como mensaje el ingreso del nombre, apellido y edad.

Public Class Form1

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

As System.EventArgs) Handles Cmdingresar.Click

Dim NOMBRE, APELLIDO As String

Dim edad As Byte

NOMBRE = InputBox("Ingrese su nombre: ")

Page 7: Elemento 3

Txtnombre.Text = NOMBRE

APELLIDO = InputBox("Ingrese su apellido: ")

Txtapellido.Text = APELLIDO

edad = InputBox("Ingrese su edad: ")

Txtedad.Text = edad

MsgBox("Mi nombre es" & NOMBRE & " " & APELLIDO & " y tengo " &

edad & " años")

End Sub

Programamos el botón NUEVO para que se blanquee los TextBox.

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

System.EventArgs) Handles Cmdnuevo.Click

Txtapellido.Text = ""

Txtnombre.Text = ""

Txtedad.Text = ""

End Sub

Private Sub Form1_Activated(ByVal sender As Object, ByVal e As

System.EventArgs) Handles Me.Activated

' Form2.Hide()

End Sub

Programamos el botón REGRESAR para cerrar el formulario de Ingreso de datos y volver al formulario de Bienvenida.

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

As System.EventArgs) Handles cmdregresar.Click

Me.Hide()

Form2.Show()

End Sub

End Class

FORMULARIO 2

Public Class Form2

Programamos el botón DATOS para cerrar el formulario de bienvenida y abrir el de ingreso de dato.

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

System.EventArgs) Handles cmddatos.Click

' Form2.Hide()

Form1.Show()

End Sub

Para el botón de salida.

Page 8: Elemento 3

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

System.EventArgs) Handles cmdsalir.Click

End

End Sub

End Class

Corrido:

Page 9: Elemento 3

3. REGIONES

Enunciado:

Diseñe un proyecto que visualice un las regiones de nuestro Ecuador.

Descripción:

Este programa tiene como formulario de inicio, un formulario para ingresar el al usuario y

la contraseña. Luego tenemos un formulario con un menú de las provincias del Ecuador, y

tenemos un formulario para cada provincia con sus respectivas descripciones.

Objetos:

7 FORM

Form1 = para la Bienvenida.

Form2 = para el menú de las provincias

Form3 = para una descripción general del Ecuador.

Form4 = para la Costa.

Form5 = para la Sierra.

Form6 = para el Oriente.

Form7 = para Galápagos.

Page 10: Elemento 3

FORM 1

3 LABEL

Label 1 = BIENVENIDOS

Label 2 = USUARIO

Label 3 = CONTRASEÑA

2 TEXT BOX

TextBox1 = para escribir en nombre del Usuario.

TextBox2 = para escribir la Contraseña.

1 BUTTON

Button1

Page 11: Elemento 3

FORM 2

6 Button

Button1 = REGIONES DEL ECUADOR

Button2 = COSTA

Button3 = SIERRA

Button4 = ORIENTE

Button5 = GALÁPAGOS

Button6 = SALIR

Page 12: Elemento 3

FORM 3

2 Label

Label1

Label2

1 Button

Button1 = REGRESAR

Page 13: Elemento 3

FORM 4

2 Label

Label1

Label2

3 Picture Box

PictureBox1

PictureBox2

PictureBox3

1 Button

Button1 = REGRESAR

Page 14: Elemento 3

FORM 5

2 Label

Label1

Label2

3 Picture Box

PictureBox1

PictureBox2

PictureBox3

1 Button

Button1 = REGRESAR

Page 15: Elemento 3

FORM 6

2 Label

Label1

Label2

3 Picture Box

PictureBox1

PictureBox2

PictureBox3

1 Button

Button1 = REGRESAR

Page 16: Elemento 3

FORM 7

2 Label

Label1

Label2

3 Picture Box

PictureBox1

PictureBox2

PictureBox3

1 Button

Button1 = REGRESAR

Page 17: Elemento 3

Código:

FORM 1

Programamos en el botón INGRESAR para verificar la contraseña que se ingresa, si es correcta se cierra el formulario 1 y se abre el formulario 2.

Public Class Form1

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

System.EventArgs) Handles Button1.Click

If (TextBox2.Text = 1234) Then

Me.Hide()

Form2.Show()

Else

MsgBox("CONTRASEÑA INCORRECTA")

TextBox2.Focus()

TextBox2.SelectionStart = 0

TextBox2.Text = ""

End If

End Sub

End Class

FORM 2

Public Class Form2

Botón REGIONES DEL ECUADOR.

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

System.EventArgs) Handles Button1.Click

Form3.Show()

End Sub

Botón COSTA

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

System.EventArgs) Handles Button3.Click

Me.Hide()

Form4.Show()

End Sub

Botón SIERRA

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

System.EventArgs) Handles Button2.Click

Me.Hide()

Form5.Show()

End Sub

Page 18: Elemento 3

Botón ORIENTE

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

System.EventArgs) Handles Button4.Click

Me.Hide()

Form6.Show()

End Sub

Botón GALÁPAGOS

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

System.EventArgs) Handles Button5.Click

Me.Hide()

Form7.Show()

End Sub

Botón SALIR

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

System.EventArgs) Handles Button6.Click

End

End Sub

End Class

FORM 3

Botón REGRESAR

Public Class Form3

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

System.EventArgs) Handles Button1.Click

Me.Hide()

Form2.Show()

End Sub

End Class

FORM 4

Botón REGRESAR

Public Class Form4

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

System.EventArgs) Handles Button1.Click

Me.Hide()

Form2.Show()

End Sub

End Class

Page 19: Elemento 3

FORM 5

Botón REGRESAR

Public Class Form5

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

System.EventArgs) Handles Button1.Click

Me.Hide()

Form2.Show()

End Sub

End Class

FORM 6

Botón REGRESAR

Public Class Form6

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

System.EventArgs) Handles Button1.Click

Me.Hide()

Form2.Show()

End Sub

End Class

FORM 6

Botón REGRESAR

Public Class Form7

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

System.EventArgs) Handles Button1.Click

Me.Hide()

Form2.Show()

End Sub

End Class

Page 20: Elemento 3

4. INGRESO DE 3 NOTAS

Enunciado:

En el siguiente ejercicio vamos a ingresar el nombre del alumno, nombre del módulo, las notas 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

Descripción:

El programa nos permite ingresar 3 notas, sacar el promedio, y la equivalencia según las

ponderaciones dadas.

Objetos:

1 FOM

Fom1

Page 21: Elemento 3

8 LABEL

Label1 = Nombre

Label2 = Módulo

Label3 = DEBERES

Label4 = LECCIONES

Label5 = EXAMENES

Label6 = POMEDIO

Label7 = EQUIVALENCIA

Label8 = INGESO DE 3 NOTAS

7 TEXTBOX

TextBox1 = para escribir el nombre.

TextBox2 = para escribir el módulo.

TextBox3 = txtdeberes = para la nota de deberes.

TextBox4 = txtlecciones = para las lecciones.

TextBox5 = txtexamenes = para los exámenes.

TextBox6 = txtpromedio = para el promedio.

TextBox7 = txtaquiv = para la equivalencia.

2 BUTTON

Button1 = NUEVO

Button2 = SALIR

Código:

Public Class Form1

Validamos el ingreso de las notas que corresponde a deberes, que no sean mayor a 10 y calculamos el promedio y la equivalencia.

Private Sub txtdeberes_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtdeberes.TextChanged

If Val(txtdeberes.Text) > 10 Then

txtdeberes.Text = ""

Else

txtpromedio.Text = Format((Val(txtdeberes.Text) +

Val(txtlecciones.Text) + Val(txtexamen.Text)) / 3, "##.00")

End If

If Val(txtpromedio.Text) >= 7 Then

txtequiv.Text = "APROBADO"

ElseIf Val(txtpromedio.Text) > 5 & Val(txtpromedio.Text) < 7 Then

txtequiv.Text = "SUSPENSO"

Else

txtequiv.Text = "REPROBADO"

End If

Page 22: Elemento 3

End Sub

Validamos el ingreso de las notas que corresponde a lecciones, que no sean mayor a 10 y calculamos el promedio y la equivalencia. Private Sub txtlecciones_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtlecciones.TextChanged

If Val(txtdeberes.Text) > 10 Then

txtdeberes.Text = ""

Else

txtpromedio.Text = Format((Val(txtdeberes.Text) +

Val(txtlecciones.Text) + Val(txtexamen.Text)) / 3, "##.00")

End If

If Val(txtpromedio.Text) >= 7 Then

txtequiv.Text = "APROBADO"

ElseIf Val(txtpromedio.Text) > 5 & Val(txtpromedio.Text) < 7 Then

txtequiv.Text = "SUSPENSO"

Else

txtequiv.Text = "REPROBADO"

End If

End Sub

Validamos el ingreso de las notas que corresponde a exámenes, que sean mayor a 10 y calculamos el promedio y la equivalencia.

Private Sub txtexamen_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtexamen.TextChanged

If Val(txtdeberes.Text) > 10 Then

txtdeberes.Text = ""

Else

txtpromedio.Text = Format((Val(txtdeberes.Text) +

Val(txtlecciones.Text) + Val(txtexamen.Text)) / 3, "##.00")

End If

If Val(txtpromedio.Text) >= 7 Then

txtequiv.Text = "APROBADO"

ElseIf Val(txtpromedio.Text) > 5 & Val(txtpromedio.Text) < 7 Then

txtequiv.Text = "SUSPENSO"

Else

txtequiv.Text = "REPROBADO"

End If

End Sub

Botón NUEVO Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button1.Click

TextBox1.Text = ""

TextBox2.Text = ""

txtdeberes.Text = ""

txtlecciones.Text = ""

txtexamen.Text = ""

Page 23: Elemento 3

txtequiv.Text = ""

txtpromedio.Text = ""

End Sub

Botón SALIR

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

System.EventArgs) Handles salir.Click

End

End Sub

End Class

Corrido:

5. TABLAS DE MULTIPLICAR

Enunciado:

Diseñe un programa que me permita ingresar un número y genere la tabla de

multiplicar, el factorial, los primos y la serie de Fibonacci.

Descripción:

Este programa permite generar una serie de datos como las tablas de multiplicar,

Fibonacci, primos y factorial.

Objetos:

3 FORM

Page 24: Elemento 3

Form1 = Bienvenida.

Form2 = Tablas de multiplicar.

Form3 = Series de datos.

FORM 1

1 LABEL

Label1 = OPERACIONES CON LAZOS

3 BUTTON

Button1 = Tablas

Button2 = Serie de datos.

Button3 = Salir

Page 25: Elemento 3

FORM 2

3 LABEL

Label1 = Ingrese el factor.

Label2 = Ingrese el límite.

Label3 = TABLAS DE MULTIPLICAR

2 TEXTBOX

TextBox1 = para el ingreso del factor.

TextBox2 = para el ingreso del límite.

1 LISTBOX

ListBox1

3 BUTTON

Button1 = Regresar

Button2 = Generar

Button3 = Nuevo

Page 26: Elemento 3

FORM 3

1 LABEL

Label1 = Ingrese el límite.

1 TEXTBOX

TextBox1 = para ingresar el límite.

5 BUTTON

Button1 = Fibonacci

Button2 = Factorial

Button3 = Primos

Button4 = Limpiar

Button5 = Salir

3 LISTBOX

ListBox1

ListBox2

ListBox3

Page 27: Elemento 3

Código:

Public Class Form1

Programamos en botón Tablas para cerrar el formulario 1 y se abra el formulario 2.

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

System.EventArgs) Handles Button1.Click

Me.Hide()

Form2.Show()

Programamos en botón Serie de datos para cerrar el formulario 2 y se abra el formulario 3.

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

Botón salir.

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

System.EventArgs) Handles Button3.Click

End

End Sub

End Class

Corrido:

Page 28: Elemento 3
Page 29: Elemento 3

6. PROFORMA-LICORES

Enunciado:

Generar una proforma de vinos y licores.

Descripción:

En este programa diseñamos una proforma de vinos y licores, calculando su costo, según

la forma de pago.

Objetos:

11 LABEL

Label1 = PROFORMA

Label2 = Vinos y licores

Label3 = Cantidad

Label4 = P.Unitario

Label5 = Sub Total

Label6 = Formas de pago.

Label7 = Recargo

Label8 = Descuento

Label9 = IVA

Label10 = Total a pagar

Label11 = Licores

5 TEXTBOX

TextBox1 = txtcantidad

TextBox2 = txtprecio

Page 30: Elemento 3

TextBox3 = txttotal

TextBox4 = txtiva

TextBox5 = txtpagar

1 COMBOBOX

ComboBox 1

2 CHECKBOX

CheckBox 1 = Crédito

CheckBox 2 = Contado

2 BUTTON

Button1 = Nuevo

Button2 = Salir

Código:

Public Class Form1

Programamos las opciones del combobox. Dim datos 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

Txtprecio.Text = Val("180.85")

datos1 = Txtprecio.Text

'PictureBox1.Load("H:\PROFORMA\w1.jpg")

ElseIf datos = 1 Then

Txtprecio.Text = Val("99.00")

datos1 = Txtprecio.Text

'PictureBox1.Load("H:\PROFORMA\v1.jpg")

ElseIf datos = 2 Then

Txtprecio.Text = Val("130.99")

datos1 = Txtprecio.Text

'PictureBox1.Load("H:\PROFORMA\ch1.jpg")

ElseIf datos = 3 Then

Txtprecio.Text = Val("90.99")

datos1 = Txtprecio.Text

'PictureBox1.Load("H:\PROFORMA\sm1.jpg")

End If

End Sub

Calculamos el total, el IVA y el total pagar.

Page 31: Elemento 3

Private Sub Txtcantidad_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtcantidad.TextChanged

Txttotal.Text = Format(Val(txtcantidad.Text) *

Val(Txtprecio.Text), "##.00")

Txtiva.Text = Format(Val(Txttotal.Text * 0.12), "##.00")

Txtpagar.Text = Format(Val(Txttotal.Text) + Val(Txtiva.Text),

"##.00")

End Sub

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

System.EventArgs) Handles cmsalir.Click

End

End Sub

Blanqueamos en el botón nuevo.

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

System.EventArgs) Handles Button1.Click

txtcantidad.Clear()

Txtprecio.Clear()

Txttotal.Clear()

End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged

If CheckBox1.Checked = True Then

CheckBox2.Enabled = False

End If

If CheckBox1.Checked = False Then

CheckBox2.Enabled = True

CheckBox2.Enabled = False

End If

End Class

Page 32: Elemento 3

Corrido:

7. CASINO

Enunciado:

Diseñe una aplicación utilizando los números randomicos

Descripción:

En este programa veremos cómo manejar números randómicos para lo cual realizaremos un

proyecto llamado casino

Objetos:

Page 33: Elemento 3

4 LABEL

Label1 = CASINO

Label2

Label3

Label4

2 PICTUREBOX

PictureBox1 = Felicidades

PictureBox2 = carita triste

2 BUTTON

Button1 = Jugar

Button2 = Salir

Page 34: Elemento 3

Código:

Public Class Form1

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

System.EventArgs) Handles Button1.Click

Dim n1, n2, n3

Do

n1 = Int(Rnd() * 10)

Loop While (n1 > 1) And (n1 <= 6)

Label2.Text = n1

Do

n2 = Int(Rnd() * 10)

Loop While (n2 > 1) And (n2 <= 6)

Label3.Text = n2

Do

n3 = Int(Rnd() * 10)

Loop While (n3 > 1) And (n3 <= 6)

Label4.Text = n3

If (Label2.Text = Label3.Text) And (Label3.Text = Label4.Text)

Then

MsgBox("FELICIDADES, GANASTE.!!!.")

PictureBox1.Visible = True

PictureBox2.Visible = False

Else

PictureBox1.Visible = False

PictureBox2.Visible = True

MsgBox("PERDISTE.!!!.")

End If

End Sub

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

System.EventArgs) Handles Label2.Click

End Sub

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

As System.EventArgs) Handles PictureBox1.Click

End Sub

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

System.EventArgs) Handles Button2.Click

End

End Sub

End Class

Page 35: Elemento 3

Corrido:

8. PARTES DE LA COMPUTADORA

Enunciado:

Desarrollo de una proforma de las partes del computador.

Descripción:

Este programa nos permite escoger las partes de un computador, y obtener el

costo total del mismo.

Page 36: Elemento 3

Objetos:

En el primer formulario utilizaremos

BUTTON

Cantidad 2

Se utiliza dos buttom para:

Button1 = Ingresar

Button2 = Salir

LABEL

Cantidad 2

Se utiliza 2 label para designar el nombre según el requerimiento.

Como tenemos el primer label1 para ubicar el tema del formulario en mi caso acceso a la

proforma

El label2 escrito INGRESE LA CLAVE

TEXTBOX

Cantidad 1

Utilizamos 1 textbox para digitar LA CLAVE

Page 37: Elemento 3

FORM 2

En el segundo formulario utilizaremos

BUTTON

Cantidad 3

Se utiliza tres buttom para:

Button1 = Nuevo proforma

Button2 = Regresar a la página de inicio

Button3 = Salir

LABEL

Cantidad 22

Se utiliza 2 label para designar el nombre según el requerimiento.

Label1 = proforma partes del computador

Page 38: Elemento 3

Label2 = datos del cliente

Label3 = nombre

Label4 = Apellido

Label5 = fecha

Label6 = # de proforma

Label7 = Monitores

Label8 = Impresoras

Label9 =discos duros

Label10 =Procesadores

Label11 =Teclado

Label12 = # de proforma

Label13 =Escoja la forma de pago

Label14 = cantidad

Label15 = P.unitario

Label16 =P. total

Label17 =Sub Total

Label18 = Iva

Label18 = Total a pagar

TEXTBOX

Cantidad 24

Txtiva= iva

Txtsubtotal= subtotal

Txttotal = total que a comprado

Txtpunitario= el precio unitario del monitor

Txtcantidad= ingreso para la cantidad de monitores

Txtptotal= el precio tatal de la contidad de monitores comprados

Txtpunitario2 = el precio unitario de la impresora

Txtcantidad2 = ingreso para la cantidad de impresoras

Txtptotal2 = el precio tatal de la contidad de inpresoras

comprados

Page 39: Elemento 3

Txtpunitario3 = el precio unitario del disco duro

Txtcantidad3 = ingreso para la cantidad de discos duros

Txtptotal3 = el precio tatal de la contidad de discos duros

comprados

Txtpunitario4 = el precio unitario de el procesador

Txtcantidad4 = ingreso para la cantidad de procesadores

Txtptotal4 = = el precio tatal de la contidad de procesadores

comprados

Txtpunitario5 = el precio unitario de el teclado

Txtcantidad5 = ingreso para la cantidad de teclados

Txtptotal5 = = el precio tatal de la contidad de teclados

comprados

Txtcontado = se imprimera el valor a pagar cuando elija pagar al

contado

Txtcredito = se imprimera el valor a pagar cuando elija pagar a

credito

Txtnombre = ingreso del nombre del cliente

Txtapellido = ingreso del apellido del cliente

Txtfecha = ingreso de la fecha de compra

Txtproforma = ingreso del numero de proforma

CHECKBOX

Cantidad 2

CheckBox1 = Contado

CheckBox2 = Crédito

Código:

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

ElseIf datos1 = 1 Then

txtunitario1.Text = (Val("130.45"))

datos1 = txtunitario1.Text

'PictureBox1.load("J/EMPRESA DE

COMPUADORAS/imagenes/mainboard")

ElseIf datos1 = 2 Then

Page 40: Elemento 3

txtunitario1.Text = (Val("149.59"))

datos1 = txtunitario1.Text

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

ElseIf datos = 1 Then

txtunitario2.Text = (Val("35.90"))

datos2 = txtunitario2.Text

ElseIf datos = 2 Then

txtunitario2.Text = (Val("15.67"))

datos2 = txtunitario2.Text

ElseIf datos = 3 Then

txtunitario2.Text = (Val("20.45"))

datos2 = txtunitario2.Text

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

ElseIf datos = 1 Then

txtunitario3.Text = (Val("120.32"))

datos3 = txtunitario3.Text

ElseIf datos = 2 Then

txtunitario3.Text = (Val("146.65"))

datos3 = txtunitario3.Text

ElseIf datos = 3 Then

txtunitario3.Text = (Val("130.23"))

datos3 = txtunitario3.Text

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

ElseIf datos = 1 Then

txtunitario4.Text = (Val("38.98"))

datos4 = txtunitario4.Text

End If

End Sub

Page 41: Elemento 3

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

ElseIf datos = 1 Then

txtunitario5.Text = (Val("198,44"))

datos5 = txtunitario5.Text

ElseIf datos = 2 Then

txtunitario5.Text = (Val("230.45"))

datos5 = txtunitario5.Text

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

ElseIf datos = 1 Then

txtunitario6.Text = (Val("95.31"))

datos6 = txtunitario6.Text

ElseIf datos = 2 Then

txtunitario6.Text = (Val("100.01"))

datos6 = txtunitario6.Text

ElseIf datos = 3 Then

txtunitario6.Text = (Val("110.34"))

datos6 = txtunitario6.Text

ElseIf datos = 4 Then

txtunitario6.Text = (Val("120.89"))

datos6 = txtunitario6.Text

ElseIf datos = 5 Then

txtunitario6.Text = (Val("145.54"))

datos6 = txtunitario6.Text

ElseIf datos = 6 Then

txtunitario6.Text = (Val("168.99"))

datos6 = txtunitario6.Text

ElseIf datos = 7 Then

txtunitario6.Text = (Val("188.99"))

datos6 = txtunitario6.Text

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

Page 42: Elemento 3

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

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))))

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

Page 43: Elemento 3

ElseIf CheckBox1.Checked = False Then

CheckBox2.Enabled = True

CheckBox1.Enabled = False

End If

End Sub

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

End Class

Corrido:

Page 44: Elemento 3
Page 45: Elemento 3

9. SISTEMA SOLAR

Enunciado:

Diseñe una aplicación que me permita conocer y obtener información de los

planetas del sistema solar.

Objetos:

1 LABEL

Label1 = SISTEMA SOLAR

1 COMBOBOX

ComboBox1

2 PICTUREBOX

PictureBox1

PictureBox2

1 TEXTBOX

TextBox1 = para el texto

Page 46: Elemento 3

1 IMAGELIST

ImageList1

Código:

Public Class Form1

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. Forma parte de los denominados

planetas interiores o rocosos y carece de satélites. Mercurio es uno de

los cuatro planetas sólidos o rocosos; es decir, tiene un cuerpo rocoso

como la Tierra."

PictureBox1.Load("C:\Users\LUGAM\Desktop\ELEMENTO

3\LENGUAJES DE PROGRAMACION\sistemasolar\imagenes\mercurio.jpg")

PictureBox2.Image = ImageList1.Images(0)

Case Is = 1

TextBox1.Text = "Venus es el segundo planeta del Sistema

Solar en orden de distancia desde el Sol, y el tercero en cuanto a

tamaño, de menor a mayor. Recibe su nombre en honor a Venus, la diosa

romana del amor. Se trata de un planeta de tipo rocoso y terrestre,

llamado con frecuencia el planeta hermano de la Tierra. Venus gira sobre

sí mismo lentamente en un movimiento retrógrado, en el mismo sentido de

las manecillas del reloj, de Este a Oeste en lugar de Oeste a Este como

el resto de los planetas."

PictureBox1.Load("C:\Users\LUGAM\Desktop\ELEMENTO

3\LENGUAJES DE PROGRAMACION\sistemasolar\imagenes\venus.jpg")

PictureBox2.Image = ImageList1.Images(1)

Case Is = 2

TextBox1.Text = "la Tierra proporciona el único ejemplo

de un entorno que ha dado lugar a la evolución de la vida"

PictureBox1.Load("C:\Users\LUGAM\Desktop\ELEMENTO

3\LENGUAJES DE PROGRAMACION\sistemasolar\imagenestierra.jpg")

PictureBox2.Image = ImageList1.Images(2)

Case Is = 3

TextBox1.Text = "Marte es el cuarto planeta del Sistema

Solar. Llamado así por el dios de la guerra de la mitología romana Marte,

recibe a veces el apodo de Planeta rojo debido a la apariencia rojiza que

le confiere el óxido de hierro que domina su superficie.Se conoce con

exactitud lo que tarda la rotación de Marte debido a que las manchas que

se observan en su superficie, oscuras y bien delimitadas, son excelentes

puntos de referencia. El año marciano dura 687 días terrestres o 668.6

soles. Un calendario marciano podría constar de dos años de 668 días por

cada tres años de 669 días.La atmósfera es lo bastante densa como para

albergar vientos muy fuertes y grandes tormentas de polvo que, en

ocasiones, pueden abarcar el planeta entero durante meses. Las teorías

actuales que predicen las condiciones en las que se puede encontrar vida,

requieren la disponibilidad de agua en estado líquido."

Page 47: Elemento 3

PictureBox1.Load("C:\Users\LUGAM\Desktop\ELEMENTO

3\LENGUAJES DE PROGRAMACION\sistemasolar\imagenes\marte.jpg")

PictureBox2.Image = ImageList1.Images(3)

Case Is = 4

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. Júpiter es el planeta con mayor masa del Sistema

SolarLa atmósfera de Júpiter no presenta una frontera clara con el

interior líquido del planeta; la transición se va produciendo de una

manera gradual."

PictureBox1.Load("C:\Users\LUGAM\Desktop\ELEMENTO

3\LENGUAJES DE PROGRAMACION\sistemasolar\imagenes\jupiter.jpg")

PictureBox2.Image = ImageList1.Images(4)

Case Is = 5

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. Saturno es un planeta visiblemente achatado en los

polos con un ecuador que sobresale formando un esferoide ovalado. La

atmósfera de Saturno posee un patrón de bandas oscuras y zonas claras

similar al de Júpiter aunque la distinción entre ambas es mucho menos

clara en el caso de Saturno."

PictureBox1.Load("C:\Users\LUGAM\Desktop\ELEMENTO

3\LENGUAJES DE PROGRAMACION\sistemasolar\imagenes\saturno.jpg")

PictureBox2.Image = ImageList1.Images(5)

Case Is = 6

TextBox1.Text = "Urano es el séptimo planeta del Sistema

Solar, el tercero en cuanto a mayor tamaño, y el cuarto más masivo. Se

llama en honor de la divinidad griega del cielo Urano . Urano es el único

planeta cuyo nombre deriva tanto de un personaje de la mitología griega

como de la mitología romana. Urano da una vuelta al Sol cada 84,01 años

terrestres. El calor interno de Urano parece ser más bajo que la de los

otros planetas gigantes, en términos astronómicos tiene un flujo térmico

bajo. Todavía no se esclarece el por qué la temperatura interna de Urano

es tan baja. La composición de la atmósfera de Urano es diferente que la

de Urano entero, ya que consiste principalmente de hidrógeno molecular y

helio. La temperatura más baja registrada en la tropopausa de Urano es de

49 K, haciendo de Urano el planeta más frío del Sistema Solar, incluso

más frío que Neptuno."

PictureBox1.Load("C:\Users\LUGAM\Desktop\ELEMENTO

3\LENGUAJES DE PROGRAMACION\sistemasolar\imagenes\urano.jpg")

PictureBox2.Image = ImageList1.Images(6)

Case Is = 7

TextBox1.Text = "Neptuno es el octavo planeta en

distancia respecto al Sol y el más lejano del Sistema Solar. Forma parte

de los denominados planetas exteriores o gigantes gaseosos, y es el

primero que fue descubierto gracias a predicciones matemáticas. Su nombre

fue puesto en honor al dios romano del mar —Neptuno—, y es el cuarto

planeta en diámetro y el tercero más grande en masa. Neptuno es un

planeta dinámico, con manchas que recuerdan las tempestades de Júpiter.

Al orbitar tan lejos del sol, Neptuno recibe muy poco calor. Su

temperatura en la superficie es de -218 °C (55 K). Sin embargo, el

planeta parece tener una fuente interna de calor. Neptuno es invisible a

simple vista, y su tamaño aparente es tan pequeño que si se observa con

Page 48: Elemento 3

pocos aumentos -lo cual es necesario cuando se está buscando un objeto-

es tan diminuto que parece una estrella."

PictureBox1.Load("C:\Users\LUGAM\Desktop\ELEMENTO

3\LENGUAJES DE PROGRAMACION\sistemasolar\imagenes\neptuno.jpg")

PictureBox2.Image = ImageList1.Images(7)

Case Is = 8

TextBox1.Text = "La órbita de Plutón es muy excéntrica y,

durante 20 de los 249 años que tarda en recorrerla, se encuentra más

cerca del Sol que Neptuno. Existen cinco lunas conocidas de Plutón.

Plutón posee una atmósfera extremadamente tenue, formada por nitrógeno,

metano y monóxido de carbono, que se congela y colapsa sobre su

superficie a medida que el planeta se aleja del Sol."

PictureBox1.Load("C:\Users\LUGAM\Desktop\ELEMENTO

3\LENGUAJES DE PROGRAMACION\sistemasolar\imagenes\pluton.jpg")

PictureBox2.Image = ImageList1.Images(8)

End Select

End Sub

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("Tierra")

ComboBox1.Items.Add("Marte")

ComboBox1.Items.Add("Jupiter")

ComboBox1.Items.Add("Saturno")

ComboBox1.Items.Add("Urano")

ComboBox1.Items.Add("Neptuno")

ComboBox1.Items.Add("Plutón")

End Sub

End Class

Page 49: Elemento 3

Corrido:

Page 50: Elemento 3

10. ALIMENTOS

Enunciado:

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.

Descripción:

Este programa nos permite conocer algunas de las propiedades alimenticias y nos muestra una imagen que la identifica.

Objetos:

1 LABEL

Label1 = PROPIEDADES DE ALIMENTOS

1 COMBOBOX

ComboBox1

2 PICTUREBOX

Page 51: Elemento 3

PictureBox1

PictureBox2

1 TEXTBOX

TextBox1 = para el texto

1 IMAGELIST

ImageList1

Código:

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 SEMESTRE\LENGUAJES DE

PROGRAMACION\alimentos\imagenes\cereales.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 SEMESTRE\LENGUAJES DE

PROGRAMACION\alimentos\imagenes\verduras.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 SEMESTRE\LENGUAJES DE

PROGRAMACION\alimentos\imagenes\leguminosas.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

Page 52: Elemento 3

por su alto contenido en colesterol, ellos forman la punta de la

pirámide."

PictureBox1.Load("H:\QUINTO SEMESTRE\LENGUAJES DE

PROGRAMACION\alimentos\imagenes\grasas.jpg")

PictureBox2.Image = ImageList1.Images(3)

End Select

End Sub

End Class

Corrido:

Page 53: Elemento 3
Page 54: Elemento 3

11. PLANILLA DE LUZ

Enunciado:

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.

Objetos:

Page 55: Elemento 3

14 Label 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

Código:

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

Page 56: Elemento 3

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()

End If

txtcosto.Text = Val(txtconsumo.Text) * 0.09

txtalumbrado.Text = Val(txtcosto.Text) * 0.03

txtbomberos.Text = Val(txtcosto.Texte) * 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

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

e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

End Class

Page 57: Elemento 3

Corrido:

12. ROL DE PAGOS

Enunciado:

Diseñar un rol de pagos.

Descripción:

Con este proyecto lograremos obtener la automatización de pago para cada empleado.

Objetos:

Page 58: Elemento 3

FORM 1

3 LABEL

Label1 = BIENVENIDOS

Label2 = USUARIO

Label3 = CONTRASEÑA

2 TEXTBOX

TextBox1

TextBox2

1 BUTTON

Button1

Page 59: Elemento 3

FORM 2

21 LABEL

Label1 = ROL DE PAGOS

Label2 = Nombre

Label3 = Apellido

Label4 = Sueldo

Label5 = Cargo

Label6 = BENEFICIOS

Label7 = N° horas extras

Label8 = Valor horas extras

Label9 = N° cargas familiares

Label10 = Valor de cargas familiares

Label11 = DESCUENTOS

Label12 = IESS

Label13 = Multas

Label14 = Préstamos

Label15 = Total ingresos

Label16 = Total egresos

Label17 = Total a recibir

Label18 = N° faltas

Label19 = Valor Préstamo

Label20 = Meses

Label21 = Cuota mensual

Page 60: Elemento 3

16 TEXTBOX

TextBox1 = txtnombre

TextBox2 = txtapellido

TextBox3 = txtsueldo

TextBox4 = txthextras

TextBox5 = txtvalhextras

TextBox6 = txtcargas

TextBox7 = txtvalcargas

TextBox8 = txtingresos

TextBox9 = txtegresos

TextBox10 = txttotal

TextBox11 = txtiess

TextBox12 = txtfaltas

TextBox13 = txtmultas

TextBox14 = txtvalprestamo

TextBox15 = txtmeses

TextBox16 = txtcuota

2 COMBOBOX

ComboBox1

ComboBox2

2 BUTTON

Button1

Button2

Código:

Public Class Form2

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

System.EventArgs) Handles MyBase.Load

ComboBox1.Items.Add("Gerente")

ComboBox1.Items.Add("Subgerente")

ComboBox1.Items.Add("Jefe de personal")

ComboBox1.Items.Add("Supervisor")

ComboBox1.Items.Add("Operador")

ComboBox1.Items.Add("Personal de servicio")

ComboBox1.Items.Add("Secretaria")

ComboBox2.Items.Add("Si")

ComboBox2.Items.Add("No")

End Sub

Private Sub Txtnombre_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txtnombre.KeyPress

Page 61: Elemento 3

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 Txtapellido_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txtapellido.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 Txthextras_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txthextras.KeyPress

If Char.IsDigit(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 Txtcargas_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txtcargas.KeyPress

If Char.IsDigit(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 Txtsueldo_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txtsueldo.KeyPress

If Char.IsDigit(e.KeyChar) Then

e.Handled = False

ElseIf Char.IsControl(e.KeyChar) Then

e.Handled = False

ElseIf Char.IsSeparator(e.KeyChar) Then

Page 62: Elemento 3

e.Handled = False

Else

e.Handled = True

End If

End Sub

Private Sub Txtvalhextras_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtvalhextras.TextChanged

Txtingresos.Text = Format(Val(Txtvalhextras.Text) +

Val(Txtvalcargas.Text), "##.00")

End Sub

Private Sub Txthextras_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txthextras.TextChanged

If Val(Txthextras.Text) = 1 Then

Txtvalhextras.Text = Format((Val(Txthextras.Text) * 17.52),

"##.00")

ElseIf Val(Txthextras.Text) = 2 Then

Txtvalhextras.Text = Format((Val(Txthextras.Text) * 17.52),

"##.00")

ElseIf Val(Txthextras.Text) = 3 Then

Txtvalhextras.Text = Format((Val(Txthextras.Text) * 17.52),

"##.00")

ElseIf Val(Txthextras.Text) = 4 Then

Txtvalhextras.Text = Format((Val(Txthextras.Text) * 17.52),

"##.00")

ElseIf Val(Txthextras.Text) = 5 Then

Txtvalhextras.Text = Format((Val(Txthextras.Text) * 17.52),

"##.00")

ElseIf Val(Txthextras.Text) = 6 Then

Txtvalhextras.Text = Format((Val(Txthextras.Text) * 17.52),

"##.00")

ElseIf Val(Txthextras.Text) = 7 Then

Txtvalhextras.Text = Format((Val(Txthextras.Text) * 17.52),

"##.00")

ElseIf Val(Txthextras.Text) = 8 Then

Txtvalhextras.Text = Format((Val(Txthextras.Text) * 17.52),

"##.00")

ElseIf Val(Txthextras.Text) = 9 Then

Txtvalhextras.Text = Format((Val(Txthextras.Text) * 17.52),

"##.00")

ElseIf Val(Txthextras.Text) = 10 Then

Txtvalhextras.Text = Format((Val(Txthextras.Text) * 17.52),

"##.00")

ElseIf Val(Txthextras.Text) > 10 Then

MsgBox("No puede ser mayor a 10")

Txthextras.Focus()

Txthextras.SelectionStart = 0

Txthextras.Text = ""

End If

End Sub

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

System.EventArgs) Handles Button2.Click

End

End Sub

Page 63: Elemento 3

Private Sub Txtcargas_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtcargas.TextChanged

If Val(Txtcargas.Text) > 2 Then

Txtvalcargas.Text = Val(Txtcargas.Text) * 10.5

Else

Txtvalcargas.Text = Val(Txtcargas.Text) * 15.5

End If

End Sub

Private Sub Txtfaltas_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtfaltas.TextChanged

If Val(Txtfaltas.Text) > 6 Then

Txtmultas.Text = 292 * 0.2 * Val(Txtfaltas.Text)

Else

Txtmultas.Text = Val(Txtfaltas.Text) * 3

End If

End Sub

Private Sub Txtsueldo_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtsueldo.TextChanged

Txtiess.Text = ((val(Txtsueldo.Text) * 11.5) / 100)

End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ComboBox1.SelectedIndexChanged

If ComboBox1.SelectedIndex = 0 Then

Txtsueldo.Text = 1500

ElseIf ComboBox1.SelectedIndex = 1 Then

Txtsueldo.Text = 1200

ElseIf ComboBox1.SelectedIndex = 2 Then

Txtsueldo.Text = 800

ElseIf ComboBox1.SelectedIndex = 3 Then

Txtsueldo.Text = 700

ElseIf ComboBox1.SelectedIndex = 4 Then

Txtsueldo.Text = 500

ElseIf ComboBox1.SelectedIndex = 5 Then

Txtsueldo.Text = 400

ElseIf ComboBox1.SelectedIndex = 6 Then

Txtsueldo.Text = 550

End If

End Sub

Private Sub Txtiess_TextChanged(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles Txtiess.TextChanged

Txtegresos.Text = Val(Txtiess.Text) + Val(Txtmultas.Text)

End Sub

Private Sub Txtingresos_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtingresos.TextChanged

Txtingresos.Text = Format(Val(Txtvalhextras.Text) +

Val(Txtvalcargas.Text), "##.00")

Page 64: Elemento 3

Txttotal.Text = Format(((Val(Txtsueldo.Text) +

Val(Txtingresos.Text) - Val(Txtegresos.Text)) - Val(Txtcuota.Text)),

"##.00")

End Sub

Private Sub Txtvalcargas_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtvalcargas.TextChanged

Txtingresos.Text = Format(Val(Txtvalhextras.Text) +

Val(Txtvalcargas.Text), "##.00")

End Sub

Private Sub Txtegresos_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtegresos.TextChanged

Txtegresos.Text = Val(Txtiess.Text) + Val(Txtmultas.Text)

Txttotal.Text = Format(((Val(Txtsueldo.Text) +

Val(Txtingresos.Text) - Val(Txtegresos.Text)) - Val(Txtcuota.Text)),

"##.00")

End Sub

Private Sub Txtmultas_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtmultas.TextChanged

Txtegresos.Text = Val(Txtiess.Text) + Val(Txtmultas.Text)

End Sub

Private Sub Txttotal_TextChanged(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles Txttotal.TextChanged

Txttotal.Text = Format(((Val(Txtsueldo.Text) +

Val(Txtingresos.Text) - Val(Txtegresos.Text)) - Val(Txtcuota.Text)),

"##.00")

End Sub

Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ComboBox2.SelectedIndexChanged

If ComboBox2.SelectedIndex = 0 Then

Label19.Visible = True

Label20.Visible = True

Label21.Visible = True

Txtvalprestamo.Visible = True

Txtmeses.Visible = True

Txtcuota.Visible = True

Else

Label19.Visible = False

Label20.Visible = False

Label21.Visible = False

Txtvalprestamo.Visible = False

Txtmeses.Visible = False

Txtcuota.Visible = False

End If

End Sub

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

System.EventArgs) Handles Label20.Click

End Sub

Page 65: Elemento 3

Private Sub Txtmeses_TextChanged(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles Txtmeses.TextChanged

Txtcuota.Text = Format((Val(Txtvalprestamo.Text) /

Val(Txtmeses.Text)), "##.00")

End Sub

Private Sub Txtcuota_TextChanged(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles Txtcuota.TextChanged

Txttotal.Text = (Val(Txtsueldo.Text) + Val(Txtingresos.Text) -

Val(Txtegresos.Text)) - Val(Txtcuota.Text)

End Sub

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

System.EventArgs) Handles Button1.Click

Txtnombre.Text = ""

Txtapellido.Text = ""

Txtsueldo.Text = ""

Txthextras.Text = ""

Txtcargas.Text = ""

Txtiess.Text = ""

Txtfaltas.Text = ""

Txtmultas.Text = ""

Txtmeses.Text = ""

Txtcuota.Text = ""

Txtvalprestamo.Text = ""

Txtvalhextras.Text = ""

Txtvalcargas.Text = ""

ComboBox1.Text = ""

ComboBox2.Text = ""

Txtingresos.Text = ""

Txtegresos.Text = ""

Txttotal.Text = ""

Txtnombre.Focus()

End Sub

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

System.EventArgs) Handles Label1.Click

End Sub

Private Sub Txtnombre_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtnombre.TextChanged

End Sub

End Class

Corrido:

Page 66: Elemento 3
Page 67: Elemento 3

13. SISTEMA DE MATRICULACION

COLEGIOS

Enunciado:

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:

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:

1 SPLITCONTAINER

Page 68: Elemento 3

15 LABEL

Label1=sistema de recaudacion

Label2=datos personales

Label3=nombre

Label4=apellido

Label5=cedula

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

10 TEXTBOX

Textbox1=txtnombre

Textbox2=txtapellido

Textbox3=txtcedula

Textbox4=txtdireccion

Textbox5=txttelefono

Textbox6= txtvmatricula

Page 69: Elemento 3

Textbox7= txtsmedico

Textbox8= txtsinternet

Textbox9= txtsrecreacion

Textbox10= txttotal

2 BUTTON

Button1=salir

Button2=nuevo

2 COMBOBOX

Combobox1=cmbcolegio

Combobox1=cmbtipo

Código:

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

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

Page 70: Elemento 3

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

Private Sub TIPO_SelectedIndexChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles TIPO.SelectedIndexChanged

dato = TIPO.SelectedIndex

If dato = 0 Then

VMATRICULA.Text = "250"

SMEDICO.Text = Format(Val(VMATRICULA.Text * 0.09), "##, 00")

SINTERNET.Text = Format(Val(VMATRICULA.Text * 0.1), "##,00")

SRECREACION.Text = Format(Val(VMATRICULA.Text * 0.12),

"##,00")

TOTAL.Text = Format(Val(VMATRICULA.Text) + Val(SMEDICO.Text)

+ Val(SINTERNET.Text) + Val(SRECREACION.Text) + 5, "##,00")

ElseIf dato = 1 Then

Page 71: Elemento 3

VMATRICULA.Text = "120"

SMEDICO.Text = Format(Val(VMATRICULA.Text * 0.06), "##, 00")

SINTERNET.Text = Format(Val(VMATRICULA.Text * 0.08), "##,00")

SRECREACION.Text = Format(Val(VMATRICULA.Text * 0.1),

"##,00")

TOTAL.Text = Format(Val(VMATRICULA.Text) + Val(SMEDICO.Text)

+ Val(SINTERNET.Text) + Val(SRECREACION.Text) + 5, "##,00")

ElseIf dato = 2 Then

VMATRICULA.Text = "180"

SMEDICO.Text = Format(Val(VMATRICULA.Text * 0.08), "##, 00")

SINTERNET.Text = Format(Val(VMATRICULA.Text * 0.09), "##,00")

SRECREACION.Text = Format(Val(VMATRICULA.Text * 0.11),

"##,00")

TOTAL.Text = Format(Val(VMATRICULA.Text) + Val(SMEDICO.Text)

+ Val(SINTERNET.Text) + Val(SRECREACION.Text) + 5, "##,00")

End If

End Sub

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

System.EventArgs) Handles MyBase.Load

TIPO.Items.Add("PARTICULAR")

TIPO.Items.Add("FISCAL")

TIPO.Items.Add("FISCOMISIONAL")

COLEGIO.Items.Add("HISPANO AMÉRICA")

COLEGIO.Items.Add("GUAYAQUIL")

COLEGIO.Items.Add("BOLIVAR")

COLEGIO.Items.Add("LA SALLE")

COLEGIO.Items.Add("TIRSO DE MOLINA")

COLEGIO.Items.Add("ADVENTISTA")

COLEGIO.Items.Add("ATENAS")

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

NOMBRE.Text = ""

APELLIDO.Text = ""

TELEFONO.Text = ""

DIRECCIÓN.Text = ""

VMATRICULA.Text = ""

TIPO.Text = ""

COLEGIO.Text = ""

SINTERNET.Text = ""

SMEDICO.Text = ""

SRECREACION.Text = ""

TOTAL.Text = ""

End Sub

Page 72: Elemento 3

Private Sub SplitContainer1_Panel2_Paint(ByVal sender As

System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles

SplitContainer1.Panel2.Paint

End Sub

End Class

Corrido:

14. NOTAS SEMESTRE

Enunciado:

Realizar un programa que permita realizar el control de notas de los estudiantes.

Objetos:

Page 73: Elemento 3

GROUPBOX1

5 LABEL

Label1 = CONTROL DE NOTAS

Label2 = Nombre

Label3 = Apellido

Label4 = Semestre

Label5 = Paralelo

2 TEXTBOX

TextBox1 = para nombre

TextBox2 = para apellido

2 COMBOBOX

ComoBox1 = cmdsemestre

ComboBox2 = cmbparalelo

GROUPBOX 2

Código:

Public Class Form1

Page 74: Elemento 3

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

System.EventArgs) Handles Button2.Click

End

End Sub

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

System.EventArgs) Handles GroupBox2.Enter

End Sub

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

System.EventArgs) Handles GroupBox1.Enter

End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

Cmbsemestre.SelectedIndexChanged

If Cmbsemestre.SelectedIndex = 0 Then

Lbl1.Visible = True

Lbl2.Visible = True

Lbl3.Visible = True

Lbl4.Visible = True

Lbl5.Visible = True

Lbl6.Visible = True

Else

Lbl1.Visible = False

Lbl2.Visible = False

Lbl3.Visible = False

Lbl4.Visible = False

Lbl5.Visible = False

Lbl6.Visible = False

End If

Select Case (Cmbsemestre.SelectedIndex)

Case Is = 0

Lbl1.Text = "Realidad Nacional"

Lbl2.Text = "Trabajo en Equipo"

Lbl3.Text = "Física"

Lbl4.Text = "Programación I"

Lbl5.Text = "Matematica II"

Lbl6.Text = "Investigación"

Case Is = 1

Lbl1.Text = "Psicologìa General"

Lbl2.Text = "Matematica Avanzada"

Lbl3.Text = "Electronica y Circuitos"

Lbl4.Text = "Modelos Pedagógicos"

Lbl5.Text = "Programación II"

Lbl6.Text = "Tutoría"

Case Is = 2

Lbl1.Text = "Lenguaje de Programación"

Lbl2.Text = "Mantenimiento y Arquitectura II"

Lbl3.Text = "Gestor de Base de datos"

Lbl4.Text = "Planificación Curricular"

Lbl5.Text = "Problemas del Aprendizaje"

Lbl6.Text = "Herramientas Multimedia"

Case Is = 3

Page 75: Elemento 3

Lbl1.Text = "Práctica Pre-Profesionales"

Lbl2.Text = "Sistemas Operativos"

Lbl3.Text = "Programación WEB I"

Lbl4.Text = "Gestión de Proyectos"

Lbl5.Text = "Sistematización 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")

Cmbsemestre.Items.Add("Tercero")

Cmbsemestre.Items.Add("Quinto")

Cmbsemestre.Items.Add("Séptimo")

Cmbparalelo.Items.Add("A")

Cmbparalelo.Items.Add("B")

Cmbparalelo.Items.Add("U")

End Sub

Private Sub Txtnombre_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txtnombre.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 Txtapellido_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txtapellido.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 Txt1_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt1.KeyPress

If Char.IsDigit(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

Page 76: Elemento 3

Private Sub Txt2_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt2.KeyPress

If Char.IsDigit(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 Txt3_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt3.KeyPress

If Char.IsDigit(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 Txt4_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt4.KeyPress

If Char.IsDigit(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 Txt5_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt5.KeyPress

If Char.IsDigit(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 Txt6_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt6.KeyPress

If Char.IsDigit(e.KeyChar) Then

e.Handled = False

Page 77: Elemento 3

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 Txt7_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt7.KeyPress

If Char.IsDigit(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 Txt8_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt8.KeyPress

If Char.IsDigit(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 Txt9_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt9.KeyPress

If Char.IsDigit(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 Txt10_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt10.KeyPress

If Char.IsDigit(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

Page 78: Elemento 3

e.Handled = True

End If

End Sub

Private Sub Txt11_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt11.KeyPress

If Char.IsDigit(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 Txt12_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt12.KeyPress

If Char.IsDigit(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 Txt13_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt13.KeyPress

If Char.IsDigit(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 Txt14_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt14.KeyPress

If Char.IsDigit(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

Page 79: Elemento 3

Private Sub Txt15_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt15.KeyPress

If Char.IsDigit(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 Txt16_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt16.KeyPress

If Char.IsDigit(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 Txt17_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt17.KeyPress

If Char.IsDigit(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 Txt18_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txt18.KeyPress

If Char.IsDigit(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 Txt3_TextChanged(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles Txt3.TextChanged

If Val(Txt3.Text) < 1 Or Val(Txt3.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt3.Text = ""

Page 80: Elemento 3

End If

Txtprom1.Text = Format(((Val(Txt1.Text) + Val(Txt2.Text) +

Val(Txt3.Text)) / 3), "##.00")

If Txtprom1.Text >= 7 Then

Txtequi1.Text = "Aprobado"

ElseIf Txtprom1.Text >= 5 And Txtprom1.Text < 7 Then

Txtequi1.Text = "Suspenso"

ElseIf Txtprom1.Text < 5 Then

Txtequi1.Text = "Reprobado"

End If

End Sub

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

As System.EventArgs) Handles Txt6.TextChanged

If Val(Txt6.Text) < 1 Or Val(Txt6.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt6.Text = ""

End If

Txtprom2.Text = Format(((Val(Txt4.Text) + Val(Txt5.Text) +

Val(Txt6.Text)) / 3), "##.00")

If Txtprom2.Text >= 7 Then

Txtequi2.Text = "Aprobado"

ElseIf Txtprom2.Text >= 5 And Txtprom2.Text < 7 Then

Txtequi2.Text = "Suspenso"

ElseIf Txtprom2.Text < 5 Then

Txtequi2.Text = "Reprobado"

End If

End Sub

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

As System.EventArgs) Handles Txt9.TextChanged

If Val(Txt9.Text) < 1 Or Val(Txt9.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt9.Text = ""

End If

Txtprom3.Text = Format(((Val(Txt7.Text) + Val(Txt8.Text) +

Val(Txt9.Text)) / 3), "##.00")

If Txtprom3.Text >= 7 Then

Txtequi3.Text = "Aprobado"

ElseIf Txtprom3.Text >= 5 And Txtprom3.Text < 7 Then

Txtequi3.Text = "Suspenso"

ElseIf Txtprom3.Text < 5 Then

Txtequi3.Text = "Reprobado"

End If

End Sub

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

As System.EventArgs) Handles Txt12.TextChanged

If Val(Txt12.Text) < 1 Or Val(Txt12.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt12.Text = ""

End If

Txtprom4.Text = Format(((Val(Txt10.Text) + Val(Txt11.Text) +

Val(Txt12.Text)) / 3), "##.00")

If Txtprom4.Text >= 7 Then

Txtequi4.Text = "Aprobado"

ElseIf Txtprom4.Text >= 5 And Txtprom4.Text < 7 Then

Page 81: Elemento 3

Txtequi4.Text = "Suspenso"

ElseIf Txtprom4.Text < 5 Then

Txtequi4.Text = "Reprobado"

End If

End Sub

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

As System.EventArgs) Handles Txt15.TextChanged

If Val(Txt15.Text) < 1 Or Val(Txt15.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt15.Text = ""

End If

Txtprom5.Text = Format(((Val(Txt13.Text) + Val(Txt14.Text) +

Val(Txt15.Text)) / 3), "##.00")

If Txtprom5.Text >= 7 Then

Txtequi5.Text = "Aprobado"

ElseIf Txtprom5.Text >= 5 And Txtprom5.Text < 7 Then

Txtequi5.Text = "Suspenso"

ElseIf Txtprom5.Text < 5 Then

Txtequi5.Text = "Reprobado"

End If

End Sub

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

As System.EventArgs) Handles Txt18.TextChanged

If Val(Txt17.Text) < 1 Or Val(Txt17.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt17.Text = ""

End If

Txtprom6.Text = Format(((Val(Txt16.Text) + Val(Txt17.Text) +

Val(Txt18.Text)) / 3), "##.00")

If Txtprom6.Text >= 7 Then

Txtequi6.Text = "Aprobado"

ElseIf Txtprom6.Text >= 5 And Txtprom6.Text < 7 Then

Txtequi6.Text = "Suspenso"

ElseIf Txtprom6.Text < 5 Then

Txtequi6.Text = "Reprobado"

End If

End Sub

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

As System.EventArgs) Handles Txt1.TextChanged

If Val(Txt1.Text) < 1 Or Val(Txt1.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt1.Text = ""

End If

End Sub

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

As System.EventArgs) Handles Txt2.TextChanged

If Val(Txt2.Text) < 1 Or Val(Txt2.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt2.Text = ""

End If

End Sub

Page 82: Elemento 3

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

As System.EventArgs) Handles Txt4.TextChanged

If Val(Txt4.Text) < 1 Or Val(Txt4.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt4.Text = ""

End If

End Sub

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

As System.EventArgs) Handles Txt5.TextChanged

If Val(Txt5.Text) < 1 Or Val(Txt5.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt5.Text = ""

End If

End Sub

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

As System.EventArgs) Handles Txt7.TextChanged

If Val(Txt7.Text) < 1 Or Val(Txt7.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt7.Text = ""

End If

End Sub

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

As System.EventArgs) Handles Txt8.TextChanged

If Val(Txt8.Text) < 1 Or Val(Txt8.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt8.Text = ""

End If

End Sub

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

As System.EventArgs) Handles Txt10.TextChanged

If Val(Txt10.Text) < 1 Or Val(Txt10.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt10.Text = ""

End If

End Sub

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

As System.EventArgs) Handles Txt11.TextChanged

If Val(Txt11.Text) < 1 Or Val(Txt11.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt11.Text = ""

End If

End Sub

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

As System.EventArgs) Handles Txt13.TextChanged

If Val(Txt13.Text) < 1 Or Val(Txt13.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt13.Text = ""

End If

End Sub

Page 83: Elemento 3

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

As System.EventArgs) Handles Txt14.TextChanged

If Val(Txt14.Text) < 1 Or Val(Txt14.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt14.Text = ""

End If

End Sub

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

As System.EventArgs) Handles Txt16.TextChanged

If Val(Txt16.Text) < 1 Or Val(Txt16.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt16.Text = ""

End If

End Sub

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

As System.EventArgs) Handles Txt17.TextChanged

If Val(Txt17.Text) < 1 Or Val(Txt17.Text) > 10 Then

MsgBox("Valor incorrecto")

Txt17.Text = ""

End If

End Sub

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

System.EventArgs) Handles Button3.Click

Txtpromg.Text = Format(((Val(Txtprom1.Text) + Val(Txt2.Text) +

Val(Txt3.Text) + Val(Txt4.Text) + Val(Txt5.Text) + Val(Txt6.Text)) / 6),

"##.00")

End Sub

Private Sub Txtpromg_TextChanged(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles Txtpromg.TextChanged

End Sub

Private Sub Txtnombre_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtnombre.TextChanged

End Sub

End Class

Corrido:

Page 84: Elemento 3

15. EXAMEN PARCIAL

Enunciado:

La Empresa AUTOCAR.SA necesita automatizar el proceso de comisiones que

entrega a sus vendedores según la siguiente programación:

La empresa se especializa en 3 líneas de vehículos, los mismos que deben poder ser

seleccionados y se visualicen sus datos complementarios:

Camionetas 22 000,00

Automóviles 25 00,00

Furgones 35 00,00

Cada uno de los vehículos tienen sus características de color, aire acondicionado y

demás.

Se necesita controlar por cada vendedor cuantas ventas han realizado y cuanto le

corresponde por concepto de comisión.

Si el valor de la venta está entre 20 000 y 25 000 la comisión es el 4%.

Si el valor de la venta está sobre 25 000 hasta los 35 000 la comisión es el 5%.

Obtenga el valor total de comisión por vendedor y el total que la empresa debe pagar.

La empresa tiene 3 vendedores de los cuales se debe seleccionar el código y se

despliegan los datos personales de cada vendedor.

Utilice un diseño adecuado de tal manera que permita visualizar toda la información

requerida.

Page 85: Elemento 3

Objetos:

PICTUREBOX

PictureBox1=imagen del auto

3 GROUPBOX

GroupBox1=Datos personales

GroupBox2=Datos del vehículo

GroupBox3=Valores totales

19 LABEL

Label1= Tema

Label2=Código

Label3= Nombre

Label4= Apellido

Label5=Cedula

Label6=Dirección

Label7=Teléfono

Label8=Tipo de vehículo

Page 86: Elemento 3

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

10 TEXTBOX

Textbox1=txtnombres

Textbox2=txtapellido

Textbox3=txtcedula

Textbox4=txtdireccion

Textbox4=txttelefono

Textbox5=txttvehiculo

Textbox6=txtvalor

Textbox7=txtvalventa

Textbox8=txtcomvendedor

Textbox9=txttotcomision

Textbox10=txttotpagar

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

3 BUTTON

Button1= Para Nuevo

Button2= Para Añadir Venta

Button3= Para Salir

Page 87: Elemento 3

Código:

Public Class Form1

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

System.EventArgs) Handles Label3.Click

End Sub

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

System.EventArgs) Handles MyBase.Load

ComboBox1.Items.Add("Camionetas")

ComboBox1.Items.Add("Automóviles")

ComboBox1.Items.Add("Furgones")

Cmdvendedores.Items.Add("Vendedor 1")

Cmdvendedores.Items.Add("Vendedor 2")

Cmdvendedores.Items.Add("Vendedor 3")

Cmdcolor.Items.Add("Negro")

Cmdcolor.Items.Add("Rojo")

Cmdcolor.Items.Add("Plateado")

Cmdcolor.Items.Add("Azul")

Cmdcolor.Items.Add("Blanco")

Cmdcolor.Items.Add("Plateado")

Cmdcolor.Items.Add("Violeta")

End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ComboBox1.SelectedIndexChanged

If ComboBox1.SelectedIndex = 0 Then

Txtprecio.Text = 2200000

TextBox1.Text = ("MAZDA b2000")

TextBox2.Text = ("Modelo 1990")

TextBox3.Text = ("Dirección Mecánica")

TextBox4.Text = ("2 puertas")

ElseIf ComboBox1.SelectedIndex = 1 Then

Txtprecio.Text = 2500000

TextBox1.Text = ("Suzuki")

TextBox2.Text = ("Modelo 1998")

TextBox3.Text = ("Dirección Mecánica")

TextBox4.Text = ("3 puertas")

ElseIf ComboBox1.SelectedIndex = 2 Then

Txtprecio.Text = 3500000

TextBox1.Text = ("HINO")

TextBox2.Text = ("Modelo 2009")

TextBox3.Text = ("Dirección Mecánica")

TextBox4.Text = ("6 mtrs largo, 2 mtrs ancho")

End If

End Sub

Private Sub Cmdvendedores_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

Cmdvendedores.SelectedIndexChanged

Lbl1.Visible = True

Lbl2.Visible = True

Page 88: Elemento 3

Lbl3.Visible = True

Lbl4.Visible = True

Lbl5.Visible = True

Txtnombre.Visible = True

Txtapellido.Visible = True

Txtci.Visible = True

txtdireccion.Visible = True

txttelefono.Visible = True

If Cmdvendedores.SelectedIndex = 0 Then

TextBox1.Text = ("001")

Txtnombre.Text = ("Danilo")

Txtapellido.Text = ("Marcial")

Txtci.Text = ("184785962-6")

txtdireccion.Text = ("Ambato")

txttelefono.Text = ("032569874")

ElseIf Cmdvendedores.SelectedIndex = 1 Then

TextBox1.Text = ("002")

Txtnombre.Text = ("Mercy")

Txtapellido.Text = ("Ulloa")

Txtci.Text = ("18142547-0")

txtdireccion.Text = ("Ambato")

txttelefono.Text = ("032847563")

ElseIf Cmdvendedores.SelectedIndex = 2 Then

TextBox1.Text = ("003")

Txtnombre.Text = ("Sebastian")

Txtapellido.Text = ("Gamboa")

Txtci.Text = ("184256639-0")

txtdireccion.Text = ("Ambato")

txttelefono.Text = ("032425463")

End If

End Sub

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

e As System.EventArgs) Handles Txtventas.TextChanged

If Cmdvendedores.SelectedIndex = 0 Then

TextBox1.Text = ("001")

ElseIf Cmdvendedores.SelectedIndex = 1 Then

TextBox1.Text = ("002")

ElseIf Cmdvendedores.SelectedIndex = 2 Then

TextBox1.Text = ("003")

End If

End Sub

Private Sub Cmdcolor_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

Cmdcolor.SelectedIndexChanged

End Sub

Private Sub Cmdmodelo_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs)

End Sub

Page 89: Elemento 3

Private Sub Txtcomision_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtcomision.TextChanged

End Sub

Private Sub Txtprecio_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Txtprecio.TextChanged

If Val(Txtprecio.Text) >= 20000 And Val(Txtprecio.Text) <= 25000

Then

Txtcomision.Text = Format((Val(Txtventas.Text) * 0.04),

"##.00")

ElseIf Val(Txtprecio.Text) > 25000 And Val(Txtprecio.Text) <=

30000 Then

Txtcomision.Text = Format((Val(Txtventas.Text) * 0.05),

"##.00")

End If

End Sub

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

System.EventArgs) Handles Button1.Click

Cmdvendedores.Text = ""

ComboBox1.Text = ""

TextBox1.Text = ""

TextBox2.Text = ""

TextBox3.Text = ""

TextBox4.Text = ""

TextBox1.Text = ""

Txtnombre.Text = ""

Txtapellido.Text = ""

Txtci.Text = ""

txtdireccion.Text = ""

txttelefono.Text = ""

Txtprecio.Text = ""

Cmdcolor.Text = ""

End Sub

End Class

Corrido:

Page 90: Elemento 3

16. EXAMEN DEL PARCIAL (ESCALAFON)

Enunciado:

1.- Se necesita automatizar el proceso de escalafón de los docentes de la Carrera de Docencia en Informática de la Facultad de Ciencias Humanas y de la Educación de la Universidad Técnica Ambato, bajo los siguientes parámetros. 1.- Se trabaja en un formato de Fichas 2.- La Ficha Datos Personales permite el ingreso de información personal del docente Cedula

Nombres

Dirección

Teléfono 3.- La Ficha Estudios Realizados permite el ingreso de los siguientes Datos Título Obtenido Magister 200 PHD 300 Tercer Nivel 100 Méritos Mejor Egresado 100 Reconocimientos 50 Publicaciones Libros 100 Revistas 50 Artículos Indexados 50 Idiomas Hablar, Leer, Escribir 50 Leer, Entender 30

Page 91: Elemento 3

Proyectos Investigación 30 Vinculación 30 Otros 10 Cada escala equivale a 200 puntos para realizar un ascenso. Determine la escala que le corresponde al docente y el sueldo promedio, considerando que todos los docentes ganan Usd 540, y por cada escala le corresponde Usd 200,00 adicionales. Obtenga el total de docentes por cada escala y el valore acumulado correspondiente al sueldo, el proceso es repetitivo.

Objetos:

24 LABEL

Label1= tema del examen

Label2=nombre

Label3=dirección

Label4= cedula

Label5=teléfono

Label6=detalle

Label7=tipo

Page 92: Elemento 3

Label8=valor parcial

Label9=valor total

Label10=título obtenido

Label11= méritos

Label12= publicaciones

Label13= idiomas

Label14=proyectos

Label15= total de puntos

Label16=escala

Label17=sueldo

Label18=nivel 1

Label19=nivel 2

Label20=nivel 3

Label21 =nivel 4

Label22= nivel 5

Label23= número de docentes

Label24= sueldo total

27 TEXTBOX

Textbox1=txtnombres

Textbox2=txtdireccion

Textbox3=cedula

Textbox4=txttelefono

Textbox5=txttitulo

Textbox6=txtmeri

Textbox7=txtvpubli

Textbox8=txtvidio

Textbox9=txtproyec

Textbox10=txtitotal

Textbox11=txtmertotal

Textbox12=txtpublitotal

Textbox13=txtidiototal

Textbox14=txtproyetotal

Textbox15=txtpuntos

Textbox16=txtescala

Textbox17=txtsueldo

Textbox18=txtn1

Page 93: Elemento 3

Textbox19=txtn2

Textbox20=txtn3

Textbox21=txtn4

Textbox22=txtn5

Textbox23=txtsuel1

Textbox24=txtsuel2

Textbox25=txtsuel3

Textbox26=txtsuel4

Textbox27=txtsuel5

5 COMBOBOX

Combobox1= para el ingreso de los títulos obtenidos

Combobox2= para el ingreso de los méritos obtenidos

Combobox3= para el ingreso de las publicaciones

Combobox4= para el ingreso de los idiomas culminados

Combobox5= para el ingreso de los proyectos realizados

Código:

Public Class Form1

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ComboBox1.SelectedIndexChanged

Select Case (ComboBox1.SelectedIndex)

Case Is = 0

txttitulo.Text = 200

Case Is = 1

txttitulo.Text = 300

Case Is = 2

txttitulo.Text = 100

End Select

txttitotal.Text = Val(txttitulo.Text) + Val(txttitotal.Text)

End Sub

Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ComboBox2.SelectedIndexChanged

Select Case (ComboBox2.SelectedIndex)

Case Is = 0

txtvmeri.Text = 100

Case Is = 1

txtvmeri.Text = 50

End Select

txtmertotal.Text = Val(txtmertotal.Text) + Val(txtvmeri.Text)

End Sub

Page 94: Elemento 3

Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ComboBox3.SelectedIndexChanged

Select Case (ComboBox3.SelectedIndex)

Case Is = 0

txtvpubli.Text = 100

Case Is = 1

txtvpubli.Text = 50

Case Is = 2

txtvpubli.Text = 50

End Select

txtpublitotal.Text = Val(txtvpubli.Text) +

Val(txtpublitotal.Text)

End Sub

Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ComboBox4.SelectedIndexChanged

Select Case (ComboBox4.SelectedIndex)

Case Is = 0

txtvidio.Text = 50

Case Is = 1

txtvidio.Text = 30

End Select

txtidiototal.Text = Val(txtidiototal.Text) + Val(txtvidio.Text)

End Sub

Private Sub ComboBox5_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ComboBox5.SelectedIndexChanged

Dim a As Byte

Select Case (ComboBox5.SelectedIndex)

Case Is = 0

txtproyec.Text = 30

Case Is = 1

txtproyec.Text = 30

Case Is = 2

txtproyec.Text = 10

End Select

txtproyetotal.Text = Val(txtproyetotal.Text) +

Val(txtproyec.Text)

txtpuntos.Text = Val(txttitotal.Text) + Val(txtmertotal.Text) +

Val(txtpublitotal.Text) + Val(txtidiototal.Text) +

Val(txtproyetotal.Text)

If Val(txtpuntos.Text) >= 200 And Val(txtpuntos.Text) <= 399 Then

txtescala.Text = "Nivel 1"

txtsueldo.Text = 740

a = 1

txtn1.Text = a + Val(txtn1.Text)

txtsuel1.Text = Val(txtsuel1.Text) + Val(txtsueldo.Text)

ElseIf Val(txtpuntos.Text) >= 400 And Val(txtpuntos.Text) <= 599

Then

txtescala.Text = "Nivel 2"

txtsueldo.Text = 940

a = 1

txtn2.Text = a + Val(txtn2.Text)

Page 95: Elemento 3

txtsuel2.Text = Val(txtsuel2.Text) + Val(txtsueldo.Text)

ElseIf Val(txtpuntos.Text) >= 600 And Val(txtpuntos.Text) <= 799

Then

txtescala.Text = "Nivel 3"

txtsueldo.Text = 1140

a = 1

txtn3.Text = a + Val(txtn3.Text)

txtsuel3.Text = Val(txtsuel3.Text) + Val(txtsueldo.Text)

ElseIf Val(txtpuntos.Text) >= 800 And Val(txtpuntos.Text) <= 999

Then

txtescala.Text = "Nivel 4"

txtsueldo.Text = 1340

a = 1

txtn4.Text = a + Val(txtn4.Text)

txtsuel4.Text = Val(txtsuel4.Text) + Val(txtsueldo.Text)

ElseIf Val(txtpuntos.Text) >= 1000 Then

txtescala.Text = "Nivel 5"

txtsueldo.Text = 1540

a = 1

txtn5.Text = a + Val(txtn5.Text)

txtsuel5.Text = Val(txtsuel5.Text) + Val(txtsueldo.Text)

End If

End Sub

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

System.EventArgs) Handles Button1.Click

txttitulo.Text = ""

txtvmeri.Text = ""

txtvpubli.Text = ""

txtvidio.Text = ""

txtproyec.Text = ""

txttitotal.Text = ""

txtmertotal.Text = ""

txtpublitotal.Text = ""

txtidiototal.Text = ""

txtproyetotal.Text = ""

ComboBox1.Text = ""

ComboBox2.Text = ""

ComboBox3.Text = ""

ComboBox4.Text = ""

ComboBox5.Text = ""

txtpuntos.Text = ""

txtsueldo.Text = ""

txtescala.Text = ""

txtnombres.Text = ""

txtcedula.Text = ""

txtdireccion.Text = ""

txttelefono.Text = ""

End Sub

End Class

Page 96: Elemento 3

Corrido:

Page 97: Elemento 3

17. CITAS MEDICA

Enunciado:

Realizar un programa que me permita realizar consultas médicas en la cual haya una serie

de especialidades y la cual contenga el control de citas de cada paciente como total de

turnos, recaudación, y el valor de cada consulta, además el programa debe contener la

opción adicionar y el botón nuevo.

Descripción:

El programa nos permitirá facilitar el control de citas médicas para contar cuantas veces se

ha acudido a esa especialidad, cuanta recaudación a donado y el valor de la consulta para

el paciente.

Objetos:

Page 98: Elemento 3

Código:

Public Class Form1

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

System.EventArgs) Handles MyBase.Load

Cmdespecialidades.Items.Add("ODONTOLOGIA")

Cmdespecialidades.Items.Add("OFTALMOLOGIA")

Cmdespecialidades.Items.Add("MEDICINA GENERAL")

Cmdespecialidades.Items.Add("CIRUGIA")

End Sub

Private Sub Cmdespecialidades_SelectedIndexChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

Cmdespecialidades.SelectedIndexChanged

Dim a, b, c, d As Integer

Select Case (Cmdespecialidades.SelectedIndex)

Case Is = 0

Txtcosto.Text = 5.0

a = 1

Txtodontologia.Text = Val(Txtodontologia.Text) + a

If Val(Txtodontologia.Text) > 5 Then

MsgBox("NO HAY TURNOS")

End If

Txttodontologia.Text = Val(Txtcosto.Text) *

Val(Txtodontologia.Text)

Case Is = 1

Txtcosto.Text = 6.0

b = 1

Txtoftalmologia.Text = Val(Txtoftalmologia.Text) + b

Page 99: Elemento 3

If Val(Txtoftalmologia.Text) > 5 Then

MsgBox("NO HAY TURNOS")

End If

Txttoftalmologia.Text = Val(Txtcosto.Text) *

Val(Txtoftalmologia.Text)

Case Is = 2

Txtcosto.Text = 4.0

c = 1

Txtmedicina.Text = Val(Txtmedicina.Text) + c

If Val(Txtmedicina.Text) > 5 Then

MsgBox("NO HAY TURNOS")

End If

Txttmedicina.Text = Val(Txtcosto.Text) *

Val(Txtmedicina.Text)

Case Is = 3

Txtcosto.Text = 6.0

d = 1

Txtcirugia.Text = Val(Txtcirugia.Text) + d

If Val(Txtcirugia.Text) > 5 Then

MsgBox("NO HAY TURNOS")

End If

Txttcirugia.Text = Val(Txtcosto.Text) *

Val(Txtcirugia.Text)

End Select

Txtgeneral.Text = Val(Txttodontologia.Text) +

Val(Txttoftalmologia.Text) + Val(Txttmedicina.Text) +

Val(Txttcirugia.Text)

End Sub

Private Sub Txtpaciente_KeyPress(ByVal sender As Object, ByVal e As

System.Windows.Forms.KeyPressEventArgs) Handles Txtpaciente.KeyPress

If Char.IsLetter(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 Cmbad_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Cmbad.Click

Txtpaciente.Text = ""

Txtcosto.Text = ""

Cmdespecialidades.Text = ""

End Sub

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

System.EventArgs) Handles Cmbnuevo.Click

Txtpaciente.Text = ""

Txtcosto.Text = ""

Cmdespecialidades.Text = ""

Txtodontologia.Text = ""

Txtoftalmologia.Text = ""

Txtmedicina.Text = ""

Txtcirugia.Text = ""

Txttodontologia.Text = ""

Page 100: Elemento 3

Txttoftalmologia.Text = ""

Txttmedicina.Text = ""

Txttcirugia.Text = ""

Txtgeneral.Text = ""

End Sub

End Class

Corrido:

18. BASE 1

Enunciado:

Diseñe una Base de Datos en Access que tenga conexión con Visual Basic.

Descripción:

Page 101: Elemento 3

Está base debe contener los datos personales. Y en Visual los Datos

Personales un Reporte del mismo.

Objetos:

2 FORM

Form1 = Entrada

Form2 = Reporte

4 LABEL

Label1=Cedula

Label2= Nombre

Label3= Apellido

Label4= Edad

Page 102: Elemento 3

4 TEXTBOX

TextBox1= Txtcedula

TextBox2=Txtnombre

TextBox3=Txtapellido

TextBox4=Txtedad

1 BUTTON

Button1= Reporte (cmdreporte)

1 DATAGRIDVIEW1

DataGridView1= DatosBindingSource1

1 CRYSTALREPORTVIEWER1

CrystalReportViewer1= Reporte

Código:

Public Class Form1

Private Sub DATOSBindingNavigatorSaveItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

DATOSBindingNavigatorSaveItem.Click

Me.Validate()

Me.DATOSBindingSource.EndEdit()

Me.TableAdapterManager.UpdateAll(Me.Database1DataSet)

End Sub

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

System.EventArgs) Handles MyBase.Load

'TODO: esta línea de código carga datos en la tabla

'Database1DataSet.DATOS' Puede moverla o quitarla según sea necesario.

Page 103: Elemento 3

Me.DATOSTableAdapter.Fill(Me.Database1DataSet.DATOS)

End Sub

En el Button Reporte la codificación es:

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

System.EventArgs) Handles Button1.Click

Reporte.Show()

End Sub

End Class

Corrido:

19. DEBER

Enunciado:

Diseñe un programa utilizando formato de fichas en lo cual tiene que estar

automatizado el ingreso de datos de los estudiantes del instituto educativo secundario

y de la universidad esto tiene que tener su informe y su reporte.

Page 104: Elemento 3

Descripción:

Tenemos que hacer una carpeta en nuestro disco con el nombre de datos y abrir el

programa Microsoft Access ya que en este programa vamos hacer los ingresos de nuestro

programa.

Ingresamos los datos que vamos a poner en nuestra aplicación, y ya grabado esto también

en nuestra carpeta y con el formato de Access 2002-2003 ya que con este formato nos

permitirá elaborar correctamente el proceso de interacción con visual.

Objetos:

DATAGRIDVIEW1

DataGridView1= DatosBindingSource1

CRYSTALREPORTVIEWER1

CrystalReportViewer1= Reporte

TOOLSTRIPMENU

Código:

Public Class MENU_PRINCIPAL

Private Sub ESTUDIANTESToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ESTUDIANTESToolStripMenuItem.Click

Dim MDImenu_principal As New Form1

MDImenu_principal.MdiParent = Me

MDImenu_principal.Show()

End Sub

Private Sub SUPERIORToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

SUPERIORToolStripMenuItem.Click

End

End Sub

Private Sub GUIAToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

GUIAToolStripMenuItem.Click

Dim MDImenu_principal As New REPORTE

MDImenu_principal.MdiParent = Me

MDImenu_principal.Show()

End Sub

End Class

Page 105: Elemento 3

Corrido:

Page 106: Elemento 3

20. BASE EMPRESA

Enunciado:

El proyecto es diseñar un sistema de manejo de bases de datos, que me permita

automatizar el ingreso de datos como: código, nombre categoría, cantidad, precio

unitario de productos o dispositivos de computadores, para lo que se debe generar el

precio total. Además el sistema a través de un menú debe generar tabla de ingreso de

datos, un reporte , y generación de consultas. cabe destacar que para el ingreso de

datos se debe ingresar a través de clave o contraseña.

Descripción:

En primer lugar creamos una nueva carpeta en nuestro disco C con nombre

PRODUCTOS, dentro de ella guardamos el proyecto realizado en Acces y guardado en

formato 2002-2003. Dentro de éste, creamos una tabla llamada DATOS con los

siguientes campo:

Código

Nombre

Categoría

Cantidad

Precio Unitario

Precio total

Los campos código, nombre y categoría son tipo texto, en cambio cantidad, p. Unitario y P.

total son te tipo numéricos.

Hecho esto cerramos el programa y abrimos Visual, y creamos un nuevo proyecto,

direccionamos ala carpeta que creamos en el disco C llamada PRODUCTOS, y empezamos

el diseño.

Diseñamos el form de entrada que nos pide clave y usuario

Luego el menú principal

Un form para visualizar reporte

Y finalmente el form para realizar consulta

Page 107: Elemento 3

Este programa nos permite ingresar datos de accesorios de computadoras con su valor

unitario y en la tabla de acces que se visualiza en visual nos muestra todos estos datos

inclusive el valor total.

A parte de esto también tenemos acceso a un reporte y a un formulario de consulta.

Objetos:

FORM1

2 TEXTBOX

TextBox1 = UsernameLabel

TextBox2 = PasswordLabel

2 LABEL

Label1 = UsernameTextBox

Label2 = PasswordTextBox

2 BUTTON

Button1 = OK

Button2 = CANCEL

1 PICTUREBOX

PictureBox1 = LogoPictureBox

FORM PARA MENU PRINCIPAL

FORM 1

3 TOOLSTRIPMENUITEM

ToolStripMenuItem1 = CONSULTAS

ToolStripMenuItem2 = REPORTE

ToolStripMenuItem3 = SALIR

FORM PARA INGRESO DE DATOS

1 FORM

Panel1

1 GROUPBOX

GroupBox1

Page 108: Elemento 3

6 ETXTBOX

TextBox1 = Ingreso de código

TextBox2 = Nombre

TextBox3 = Categoría

TextBox4 = Cantidad

TextBox5 = P.Unitario

TextBox6 = P. Total

Labels 6 código

Nombre

Categoría

Cantidad

p. unitario

p. total

FORM PARA VISUALIZAR REPORTES

Names

Form 1 REPORTE

CrystalReportViewer 1 CrystalReportViewer1

FORM PARA VISUALIZAR CONSULTA

FORM 1

DataGridView1

Page 109: Elemento 3

Código:

Public Class PRINCIPAL

Private Sub ProductosToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ProductosToolStripMenuItem.Click

Dim MDIFORM As New Form1

MDIFORM.MdiParent = Me

MDIFORM.Show()

End Sub

Private Sub SalidaToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

SalidaToolStripMenuItem.Click

End

End Sub

Private Sub DATOSToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

DATOSToolStripMenuItem.Click

Dim MDIFORM As New CONSULTAS

MDIFORM.MdiParent = Me

MDIFORM.Show()

End Sub

Private Sub VisualizacionToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

VisualizacionToolStripMenuItem.Click

Dim MDIFORM As New REPORTE

MDIFORM.MdiParent = Me

MDIFORM.Show()

End Sub

End Class

LOGINFORM1

Public Class LoginForm1

' TODO: inserte el código para realizar autenticación personalizada

usando el nombre de usuario y la contraseña proporcionada

' (Consulte http://go.microsoft.com/fwlink/?LinkId=35339).

' El objeto principal personalizado se puede adjuntar al objeto

principal del subproceso actual como se indica a continuación:

' My.User.CurrentPrincipal = CustomPrincipal

' donde CustomPrincipal es la implementación de IPrincipal utilizada

para realizar la autenticación.

' Posteriormente, My.User devolverá la información de identidad

encapsulada en el objeto CustomPrincipal

' como el nombre de usuario, nombre para mostrar, etc.

Page 110: Elemento 3

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

System.EventArgs) Handles OK.Click

If PasswordTextBox.Text = "1234" Then

MsgBox("BIENVENIDOS")

Me.Hide()

PRINCIPAL.Show()

Else

MsgBox("Password incorrecto")

UsernameTextBox.Text = ""

PasswordTextBox.Text = ""

End If

End Sub

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

System.EventArgs) Handles Cancel.Click

Me.Close()

End Sub

End Class

TABLA INGRESO DE DATOS

Public Class Form1

Private Sub DATOSBindingNavigatorSaveItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub DATOSBindingNavigatorSaveItem_Click_1(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

DATOSBindingNavigatorSaveItem.Click

Me.Validate()

Me.DATOSBindingSource.EndEdit()

Me.TableAdapterManager.UpdateAll(Me.PRODUCTOSDataSet)

End Sub

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

System.EventArgs) Handles MyBase.Load

'TODO: esta línea de código carga datos en la tabla

'PRODUCTOSDataSet.DATOS' Puede moverla o quitarla según sea necesario.

Me.DATOSTableAdapter.Fill(Me.PRODUCTOSDataSet.DATOS)

End Sub

Private Sub P_UNITARIOTextBox_TextChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

P_UNITARIOTextBox.TextChanged

P_TOTALTextBox.Text = Format(Val(P_UNITARIOTextBox.Text) *

Val(CANTIDADTextBox.Text), "###,00")

End Sub

Private Sub P_TOTALTextBox_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles P_TOTALTextBox.TextChanged

Page 111: Elemento 3

End Sub

Private Sub CANTIDADTextBox_TextChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

CANTIDADTextBox.TextChanged

P_TOTALTextBox.Text = Format(Val(P_UNITARIOTextBox.Text) *

Val(CANTIDADTextBox.Text), "###,00")

End Sub

End Class

Corrido: