115
UNIVERSIDAD TECNICA DE AMBATO FACULTAD DE CIENCIAS HUMANAS Y LA EDUCACION CARRERA DE DOCENCIA EN INFORMATICA Lenguaje de Programación I TUTORA: ING. WILMA GAVILANEZ AUTORA: EVELIN CASTRO PEÑALOZA

Ejercicios de visual

Embed Size (px)

DESCRIPTION

Programacion en visual y access

Citation preview

Page 1: Ejercicios de visual

UNIVERSIDAD TECNICA

DE AMBATO

FACULTAD DE CIENCIAS HUMANAS Y LA

EDUCACION

CARRERA DE DOCENCIA EN

INFORMATICA

Lenguaje de Programación I

TUTORA:

ING. WILMA GAVILANEZ

AUTORA:

EVELIN CASTRO PEÑALOZA

Page 2: Ejercicios de visual

Visual Basic es un ambiente gráfico de desarrollo de aplicaciones para el sistema operativo Microsoft Windows. Las aplicaciones creadas con Visual Basic están basadas en objetos y son manejadas por eventos. Visual Basic se deriva del lenguaje Basic, el cual es un lenguaje de programación estructurado. Sin embargo, Visual Basic emplea un modelo de programación manejada por eventos

Información y Conocimiento son los dos elementos claves del nuevo milenio ninguna sociedad podrá alcanzar ni puede ignorar este nuevo esquema ya las naciones no se miden por su riqueza industrial, ni sus activos físicos, ni por su poder militar, sino por la cantidad de información que produce y consume, así como por la recombinación de información nueva en un conocimiento de grado superior.

Actualmente el paradigma de programación se ha enfocado a nuevas necesidades de modernos y globales sistemas de información basados en redes y más aún en la red global de internet, actualmente es más importante poder concebir y construir sistemas de información con estas nuevas tecnologías de programación.

Page 3: Ejercicios de visual

Diferenciar entre un lenguaje estructurado y un lenguaje visual orientado a objetos.

Reconocer las secciones donde se debe programar para que los eventos respondan a las acciones del usuario.

Reconocer las secciones que forman parte de un lenguaje

visual y sus propiedades.

Reconocer como guardar un proyecto y los elementos que lo componen.

Determinar correctamente los nombres de los objetos

conforme los estándares estudiados.

Aplicar los conocimientos adquiridos dentro del aula en las

diferentes aplicaciones de visual Basic.

Page 4: Ejercicios de visual

APLICACIÓN Nº 1

TEMA: CARATULA CON SUS RESPECTIVOS DATOS PERSONALES Y LOGOS

DE LA UNIVERSIDAD.

1. Abrir un nuevo Proyecto en Visual Basic

2. Diseño del Formulario

Page 5: Ejercicios de visual

3. Componentes

FORM 1 Name Form1 Backcolor White Windowstate Maximize

PICTUREBOX Cantidad 3 Name Picturebox1 Image Logo uta

Page 6: Ejercicios de visual

Name Picturebox2 Image Logo Fche Name Picturebox3 Image Logo Carrera

LABEL Cantidad 6 Name Label 1 Text Universidad Técnica de Ambato Name Label 2 Text Facultad de Ciencias Humana y de la Educación Name Label 3 Text Carrera de docencia en Informática Name Label 4 Text Lenguaje de programación I Name Label 5 Text Tutora Name Label 6 Text Ing. Wilma Gavilanez Name Label 6 Text Autora Name Label 6 Text Evelin Castro 4.- CONCLUSION En este programa no utilizaremos ninguna programación porque es una caratula muy sencilla de realizar

Page 7: Ejercicios de visual

APLICACIÓN Nº 2

TEMA: Realice un programa que me permita ingresar los datos

personales.

1. Abrir un nuevo Proyecto en Visual Basic

2. Diseño del Formulario

3. - Componentes FORM 1

Name Form1 Backcolor 128; 128; 225 Windowstate Maximize

PICTUREBOX Cantidad 2 Name Picturebox1 Image Logo uta Name Picturebox3 Image Logo Carrera

LABEL Cantidad 5 Name Label 1 Forecolor (A su gusto) Text Datos Personales

Page 8: Ejercicios de visual

Name Label 2 Forecolor (A su gusto) Text Nombre Name Label 3 Forecolor (A su gusto) Text Apellido Name Label 4 Forecolor (A su gusto) Text Dirección Name Label 4 Forecolor (A su gusto) Text Telefono

BUTTONCantidad 2 Name Command 1 Backcolor (A su gusto) Caption Nuevo Name Command 2 Backcolor (A su gusto) Caption Salir

4. - Programacion Public Class Form1 Private Sub cmdsalir_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsalir.Click End End Sub Private Sub cmdnuevo_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdnuevo.Click txtnombre.Text = "" txtapellido.Text = "" txtdireccion.Text = "" txttelefono.Text = "" End Sub

5.- Conclusión En este es un programa nos permitirá ingresar los datos personales de una persona n veces con la opción Nuevo para volver al ingresar datos.

Page 9: Ejercicios de visual

APLICACIÓN Nº 3

TEMA: Diseñe un proyecto que visualice un las regiones del

Ecuador.

1. Abrir un nuevo Proyecto en Visual Basic

2. Diseño del Formulario

Page 10: Ejercicios de visual

3. - COMPONENTES

FORM Cantidad 6

FORM1 Name Form1 Backcolor White Windowstate Maximize LABEL Cantidad 2 Name Label 1 Text Usuario Name Label 2 Text Password

BUTTON Cantidad 1 Name Command 1 Backcolor white Caption Regiones del Ecuador

FORM2V Name Form2 Backcolor white Windowstate Maximize

PICTUREBOX Cantidad 1 Image regiones

LABEL Cantidad 1 Name Label 1 Text Regiones de Ecuador

BUTTON Cantidad 4 Name Command 1 Text Costa

Page 11: Ejercicios de visual

Name Command 1 Text Sierra Name Command 1 Text Oriente Name Command 1 Text Galapagos

FORM3 Name Form3 Backcolor 192;255;192 Windowstate Maximize

LABEL Cantidad 6 Name Label 1 Text Costa-litoral Name Label 2 Text conceptos Name Label 3 Text Costumbres Name Label 4 Text conceptos Name Label 5 Text Gastronomia Name Label 6 Text Conceptos

BUTTON Cantidad 1 Name Command 1 Text Regiones

PICTUREBOX Cantidad 4 Name PictureBox1 Image sierra Name PictureBox2 Image costumbre

Page 12: Ejercicios de visual

Name PictureBox3 Image tradicion Name PictureBox4 Image gastronomia

FORM4 Name Form4 Windowstate Maximize

LABEL Cantidad 6 Name Label 1 Text Sierra Name Label 2 Text conceptos Name Label 3 Text Costumbres Name Label 4 Text conceptos Name Label 5 Text Gastronomia Name Label 6 Text Conceptos

BUTTON Cantidad 1 Name Command 1 Text Regiones

PICTUREBOX Cantidad 4 Name PictureBox1 Image Costa Name PictureBox2 Image costumbre

Page 13: Ejercicios de visual

Name PictureBox3 Image tradicion Name PictureBox4 Image gastronomia

FORM5 Name Form4 Image Oriente Windowstate Maximize

LABEL Cantidad 6 Name Label 1 Text Oriente Name Label 2 Text conceptos Name Label 3 Text Costumbres Name Label 4 Text conceptos Name Label 5 Text Gastronomia Name Label 6 Text Conceptos

BUTTON Cantidad 1 Name Command 1 Text Regiones

PICTUREBOX Cantidad 5 Name PictureBox1 Image Oriente Name PictureBox2 Image Rios Name PictureBox3 Image tradicion

Page 14: Ejercicios de visual

Name PictureBox4 Image gastronomia Name PictureBox5 Image bebida

FORM 6 Name Form6 Image Galapagos Windowstate Maximize

LABEL Cantidad 4 Name Label 1 Text Galapagos Name Label 2 Text conceptos Name Label 3 Text Gastronomia Name Label 4 Text conceptos

PICTUREBOX Cantidad 4 Name Picturebox1 Image Galapagos Name Picturebox2 Image focas Name Picturebox3 Image gastronomia Name Picturebox4 Image comida

Page 15: Ejercicios de visual

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

System.EventArgs) Handles cmdingresar.Click

If txtcontraseña.Text = ("1234") Then

Form1.Show()

Else

MsgBox("CONTRASEÑA INCORRECTA")

txtcontraseña.Focus()

txtcontraseña.SelectionStart = 0

txtcontraseña.Text = ""

End If

End Sub

++++++++++++++++++++++++++++++++++++++++++++++++++

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

System.EventArgs) Handles Button1.Click

'Form2.Hide()

Form3.Show()

End Sub

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

As System.EventArgs) Handles Button5.Click

Form1.Show()

Me.Hide()

End Sub

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

As System.EventArgs) Handles Button2.Click

'Form2.Hide()

Form5.Show()

End Sub

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

As System.EventArgs) Handles Button3.Click

'Form2.Hide()

Form7.Show()

End Sub

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

As System.EventArgs) Handles Button4.Click

'Form2.Hide()

Form9.Show()

End Sub

End Class

5.- CONCLUSION

En el programa propuesto utilizamos objetos como Label, TextBox, Button,

ComboBox, para el diseño de nuestra aplicación.

Page 16: Ejercicios de visual

APLICACIÓN Nº 4

TEMA: INGRESO DE 3 NOTAS

En el siguiente ejercicio vamos a ingresar el nombre del alumno, nombre

del módulo, la nota de deberes, lecciones y exámenes, el promedio de las

tres notas y la equivalencia.

1. Abrir un nuevo Proyecto en Visual Basic

2. Diseño del Formulario El ingreso de notas van a ser validadas hasta un límite de 10.

La equivalencia: promedio >=7 APROBADO

Promedio >5 y <7 SUSPENSO

promedio <5 REPROBADO

Page 17: Ejercicios de visual

3. - COMPONENTES

FORM1 Name Form1 Backcolor 255;192;192 Windowstate Maximize

LABEL Cantidad 8 Name Label 1 Text Ingreso de notas Name Label 2 Text Nombre Name Label 3 Text Modulo Name Label 4 Text Deberes Name Label 5 Text Lecciones Name Label 6 Text Examenes Name Label 7 Text Promedio Name Label 8 Text Equivalencia

BUTTON Cantidad 2 Name Command 1 Backcolor 128;128;128 Caption Nuevo

Name Command 1 Backcolor 128;128;128 Caption Salir

Page 18: Ejercicios de visual

4. - PROGRAMACION

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

System.EventArgs) Handles txtdeberes.TextChanged

//VALIDACION DE DATOS

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

//EQUIVALENCIA DEPENDIENDO DEL PROMEDIO

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

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

System.EventArgs) Handles txtlecciones.TextChanged

++++++++++++++++++VALIDACION DE DATOS+++++++++++++++++++++++++++++

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

+++++++++++++++++++++++++++++ PROMEDIO++++++++++++++++++++++++++++++

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

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

Handles txtexamen.Click

Page 19: Ejercicios de visual

End Sub

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

System.EventArgs) Handles txtexamen.TextChanged

//VALIDACION DE DATOS

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

//EQUIVALENCIA DEPENDIENDO DEL PROMEDIO

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

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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 = ""

txtequiv.Text = ""

txtpromedio.Text = ""

End Sub

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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

Handles salir.Click

End

End Sub

End Class

Page 20: Ejercicios de visual

APLICACIÓN Nº 5

TEMA: TABLA DE MULTIPLICAR

1. Abrir un nuevo Proyecto en Visual Basic

2. Apariencia del Formulario.

Page 21: Ejercicios de visual

3. Componentes

FORM 1 Name Form1 Windowstate Maximize BUTTON Cantidad 3 Name Command 1 Caption Tablas Name Command 2 Backcolor (A su gusto) Caption Serie de datos Name Command 3 Backcolor (A su gusto) Caption Salir LABEL Cantidad 1 Name Label1 Forecolor (A su gusto) Caption Tablas de Multiplicar

FORM 2 Name For2 Windowstate Maximize BUTTON Cantidad 3 Name Command 1 Caption Generar Name Command 2 Backcolor (A su gusto) Caption Regresar Name Command 3 Caption Nuevo LABEL

Page 22: Ejercicios de visual

Cantidad 3 Name Label1 Caption Tablas Name Label2 Caption Ingrese el factor Name Label1 Caption Ingrese el Limite LISTBOX Cantidad 1 Name List1 List (Vacío)

FORM 3 Name Form3 Windowstate Maximize BUTTON Cantidad 5 Name Command 1 Backcolor (A su gusto) Text Fibonacci Name Command 2 Backcolor (A su gusto) Text Factorial Name Command 3 Backcolor (A su gusto) Text Primos Name Command 4 Backcolor (A su gusto) Text Salir Name Command 5 Backcolor (A su gusto) Text Limpiar

Page 23: Ejercicios de visual

LABEL Cantidad 1 Name Label1 Forecolor (A su gusto) Text Ingrese el limite LISTBOX Cantidad 3 Name List 1 List (Vacío) Name List 2 List (Vacío) Name List 3 List (Vacío) 4.-PROGRAMACION FORM 1 Public Class Form1

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

As System.EventArgs) Handles Button1.Click

Me.Hide()

Form2.Show()

End Sub

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

As System.EventArgs) Handles Button2.Click

Me.Hide()

Form3.Show()

End Sub

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

System.EventArgs) Handles MyBase.Load

End Sub

End Class

FORM 2 Public Class Form2

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

System.EventArgs) Handles Label3.Click

End Sub

Page 24: Ejercicios de visual

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

As System.EventArgs) Handles Button1.Click

Me.Hide()

Form1.Show()

End Sub

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

As System.EventArgs) Handles Button2.Click

Dim ml As Integer

For INICIO = 1 To Val(TextBox2.Text) Step 1

ml = Val(TextBox1.Text) * INICIO

ListBox1.Items.Add(INICIO & "*" & Val(TextBox1.Text) & "="

& ml)

Next

End Sub

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

As System.EventArgs) Handles Button3.Click

ListBox1.Items.Clear()

TextBox1.Clear()

TextBox2.Clear()

End Sub

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

System.EventArgs) Handles MyBase.Load

End Sub

End Class

FORM 3 Public Class Form3

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

As System.EventArgs) Handles Button1.Click

Dim fib As Integer

Dim a As Integer = 1

Dim b As Integer = 0

Dim c As Integer = 0

Dim contador As Integer = 0

For INICIO = 1 To Val(txtlimite.Text) Step 1

b = a

a = c

c = a + b

ListBox1.Items.Add(c)

Next

End Sub

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

System.EventArgs) Handles MyBase.Load

End Sub

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

As System.EventArgs) Handles Button4.Click

ListBox1.Items.Clear()

Page 25: Ejercicios de visual

ListBox2.Items.Clear()

ListBox3.Items.Clear()

txtlimite.Clear()

End Sub

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

As System.EventArgs) Handles Button2.Click

Dim x, fac As Integer

x = txtlimite.Text

fac = 1

For INICIO = x To 1 Step -1

fac = fac * INICIO

Next

ListBox2.Items.Add(fac)

End Sub

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

As System.EventArgs) Handles Button3.Click

Dim compro As Boolean = True

Dim numero As Integer

For numero = 1 To Val(txtlimite.Text) * 2

compro = True

For INICIO = 2 To numero - 1

If numero Mod INICIO = 0 Then

compro = False

End If

Next

If compro = True Then

ListBox3.Items.Add(numero)

End If

Next

End Sub

End Class

Page 26: Ejercicios de visual

APLICACIÓN Nº 6

TEMA: Generar una proforma de vinos y licores

1. Abrir un nuevo Proyecto en Visual Basic

2. Apariencia del Formulario

Page 27: Ejercicios de visual

3. Componentes

FORM

Cantidad 1

Nombre Vinos y licores

WindowState maximizada

LABEL

Cantidad 11

Nombre Label1

Caption PROFORMA

Nombre Label2

Caption VINOS Y LICORES

Nombre Label3

Caption LICORES

Nombre Label4

Caption CANTIDAD

Nombre Label5

Caption P.UNITARIO

Nombre Label6

Caption SUB.TOTAL

Nombre Label7

Caption FORMAS DE PAGO

Nombre Label8

Caption +15% DE RECARGO

Nombre Label9

Caption -20% DE DESCUENTO

Nombre Label10

Caption IVA

Nombre Label11

Caption T.A PAGAR

Page 28: Ejercicios de visual

TEXTBOX

Cantidad 5

Name Text1

Text CANTIDAD

Name Text2

Text P.UNITARIO

Name Text3

Text SUB.TOTAL

Name Text4

Text IVA

Font (A su gusto)

Name Text5

Text TOTAL A PAGAR

COMBOBOX

Cantidad 1

Name BomboBox

CHECKBOX

Cantidad 2

Nombre CheckBox1

Caption +15% DE RECARGO

Nombre CheckBox2

Caption -20% DE DESCUENTO

PICTUREBOX

Cantidad 4

Name PictureBox 1

Image wisky .jpg

Name PictureBox 2

Image vodka .jpg

Page 29: Ejercicios de visual

Name PictureBox 3

Image sanmiguel .jpg

Name PictureBox 3

Image chivas .jpg

BUTTON

Cantidad 2

Nombre Command1

Caption NUEVO

Nombre Command2

Caption SALIR

4.- Programación

FORM1

Public Class Form1

Dim datos As Integer

Dim datos1 As Double

COMBOBOX

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("C:\PROFORMA\PROFORMA\w1.jpg")

ElseIf datos = 1 Then

Txtprecio.Text = Val("99.00")

datos1 = Txtprecio.Text

PictureBox1.Load("C:\PROFORMA\PROFORMA\v1.jpg")

ElseIf datos = 2 Then

Txtprecio.Text = Val("130.99")

datos1 = Txtprecio.Text

PictureBox1.Load("C:\PROFORMA\PROFORMA\ch1.jpg")

ElseIf datos = 3 Then

Txtprecio.Text = Val("90.99")

datos1 = Txtprecio.Text

PictureBox1.Load("C:\PROFORMA\PROFORMA\sm1.jpG")

Page 30: Ejercicios de visual

End If

End Sub

CANTIDAD

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

CREDITO

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 Sub

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

SALIR

Private Sub cmsalir_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles cmsalir.Click

End

End Sub

Page 31: Ejercicios de visual

APLICACIÓN Nº 7

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

1. Abrir un nuevo Proyecto en Visual Basic

2. Apariencia del Formulario

Page 32: Ejercicios de visual

3.- COMPONENTES FORM1 Name Form1 Backcolor 128;225:128 Windowstate Maximize BUTTON Cantidad 2 Name Command 1 Text PLAY Name Command 2 Text X LABEL Cantidad 4 Name Label1 Caption casino Name Label2 Caption 0 Name Label3 Caption 0 Name Label3 Caption 0

4. - PROGRAMACION

play

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim n1 As Byte Dim n2 As Byte Dim n3 As Byte Randomize() Do n1 = Int(Rnd() * 10) n2 = Int(Rnd() * 10) n3 = Int(Rnd() * 10) Loop While (n1 > 1) And (n1 <= 6)

Page 33: Ejercicios de visual

Label2.Text = n1 Label3.Text = n2 Label4.Text = n3 If (Label2.Text = Label3.Text) And (Label2.Text = Label4.Text) Then MsgBox("Ganaste") Else MsgBox("Fallaste Intentalo nuevamente") End If End Sub End Class

Salir

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub

Captura de pantalla(Corrido)

Page 34: Ejercicios de visual

APLICACIÓN Nº 8

TEMA: Diseñe una aplicación de una proforma de las partes del

computador

1. Abrir un nuevo Proyecto en Visual Basic

2. Apariencia del Formulario

Page 35: Ejercicios de visual

3.- COMPONENTES

FORM1 Name Form1 Windowstate Maximize BUTTON Cantidad 3 Name Command 1 Text Inicio Name Command 2 Text Nuevo Name Command 3 Text Salir

LABEL Cantidad 21 Name Label1 Text Partes

Name Label2 Text Nombre

Name Label3 Text Apellido

Name Label4 Text Fecha

Name Label5 Text Nº

Name Label6 Text Monitores

Name Label7 Text Impresoras

Name Label8 Text Discos duros

Name Label9 Text Procesadores

Page 36: Ejercicios de visual

Name Label10 Text Teclado

Name Label11 Text Forma de pago

Name Label12 Text cantidad

Name Label13 Text P.unitario

Name Label14 Text P.Total

Name Label15 Text Iva

Name Label16 Text T. a pagar

Name Label17 Text Procesadores

Name Label18 Text Procesadores

Name Label19 Text Procesadores

Name Label20 Text Procesadores Name Label21 Text Procesadores

CHECKBOX

Cantidad 2

Name CheckBox1

Caption Contado

Name CheckBox2

Caption Crédito

Page 37: Ejercicios de visual

4.- Programacion

Public Class Form2 //Declarando variables

Dim DATOS As Integer Dim DATOS1 As Double //codificando el botón nuevo

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Form1.Show() Me.Hide() End Sub // Codificando el botón salir

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

System.EventArgs) Handles Button3.Click

End End Sub // Codificando el combobox monitores

Private Sub Cmbmoni_SelectedIndexChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Cmbmoni.SelectedIndexChanged

DATOS = Cmbmoni.SelectedIndex If (DATOS = 0) Then Txtpunitario.Text = Val("350.00") DATOS1 = Txtpunitario.Text ElseIf (DATOS = 1) Then Txtpunitario.Text = Val("124.00") DATOS1 = Txtpunitario.Text ElseIf (DATOS = 2) Then Txtpunitario.Text = Val("208.00") DATOS1 = Txtpunitario.Text ElseIf (DATOS = 3) Then Txtpunitario.Text = Val("408.00") DATOS1 = Txtpunitario.Text ElseIf (DATOS = 4) Then Txtpunitario.Text = Val("280.00") DATOS1 = Txtpunitario.Text End If End Sub // Codificando el combobox impresoras

Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged DATOS = ComboBox2.SelectedIndex If (DATOS = 0) Then

Page 38: Ejercicios de visual

Txtpunitario2.Text = Val("195.00") DATOS1 = Txtpunitario2.Text ElseIf (DATOS = 1) Then Txtpunitario2.Text = Val("455.00") DATOS1 = Txtpunitario2.Text ElseIf (DATOS = 2) Then Txtpunitario2.Text = Val("70.00") DATOS1 = Txtpunitario2.Text ElseIf (DATOS = 3) Then Txtpunitario2.Text = Val("125.00") DATOS1 = Txtpunitario2.Text ElseIf (DATOS = 4) Then Txtpunitario2.Text = Val("145.00") DATOS1 = Txtpunitario2.Text End If End Sub // Codificando el combobox disco duros

Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged DATOS = ComboBox3.SelectedIndex If (DATOS = 0) Then Txtpunitario3.Text = Val("110.00") DATOS1 = Txtpunitario3.Text ElseIf (DATOS = 1) Then Txtpunitario3.Text = Val("125.00") DATOS1 = Txtpunitario3.Text ElseIf (DATOS = 2) Then Txtpunitario3.Text = Val("180.00") DATOS1 = Txtpunitario3.Text ElseIf (DATOS = 3) Then Txtpunitario3.Text = Val("240.00") DATOS1 = Txtpunitario3.Text ElseIf (DATOS = 4) Then Txtpunitario3.Text = Val("135.00") DATOS1 = Txtpunitario3.Text End If End Sub // Codificando el combobox procesadores

Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged DATOS = ComboBox4.SelectedIndex If (DATOS = 0) Then Txtpunitario4.Text = Val("80.00") DATOS1 = Txtpunitario4.Text ElseIf (DATOS = 1) Then Txtpunitario4.Text = Val("120.00") DATOS1 = Txtpunitario4.Text ElseIf (DATOS = 2) Then

Page 39: Ejercicios de visual

Txtpunitario4.Text = Val("360.00") DATOS1 = Txtpunitario4.Text ElseIf (DATOS = 3) Then Txtpunitario4.Text = Val("270.00") DATOS1 = Txtpunitario4.Text ElseIf (DATOS = 4) Then Txtpunitario4.Text = Val("130.00") DATOS1 = Txtpunitario4.Text End If End Sub // Codificando el combobox teclado

Private Sub ComboBox5_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox5.SelectedIndexChanged DATOS = ComboBox5.SelectedIndex() If (DATOS = 0) Then Txtpunitario5.Text = Val("25.00") DATOS1 = Txtpunitario5.Text ElseIf (DATOS = 1) Then Txtpunitario5.Text = Val("14.00") DATOS1 = Txtpunitario5.Text ElseIf (DATOS = 2) Then Txtpunitario5.Text = Val("12.00") DATOS1 = Txtpunitario5.Text ElseIf (DATOS = 3) Then Txtpunitario5.Text = Val("15.00") DATOS1 = Txtpunitario5.Text ElseIf (DATOS = 4) Then Txtpunitario5.Text = Val("18.00") DATOS1 = Txtpunitario5.Text End If End Sub // Codificando el Txtcantidad cantidad para sacar el precio de los monitores

Private Sub Txtcantidad_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txtcantidad.TextChanged Txtptotal.Text = Format(Val(Txtcantidad.Text) * Val(DATOS1), "##.00") Txtsubtotal.Text = Format(Val(Txtptotal.Text) + Val(Txtptotal2.Text) + Val(Txtptotal3.Text) + Val(Txtptotal4.Text) + Val(Txtptotal5.Text), "##.00") Txtiva.Text = Format(Val(Txtsubtotal.Text) * 0.12, "##.00") Txttotal.Text = Format(Val(Txtsubtotal.Text) + Val(Txtiva.Text), "##.00") End Sub // Codificando el boton nuevo donde tenemos que mandar a blanquear todos

los textos

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Txtiva.Clear() Txtsubtotal.Clear() Txttotal.Clear()

Page 40: Ejercicios de visual

Txtpunitario.Clear() Txtcantidad.Clear() Txtptotal.Clear() Txtpunitario2.Clear() Txtcantidad2.Clear() Txtptotal2.Clear() Txtpunitario3.Clear() Txtcantidad3.Clear() Txtptotal3.Clear() Txtpunitario4.Clear() Txtcantidad4.Clear() Txtptotal4.Clear() Txtpunitario5.Clear() Txtcantidad5.Clear() Txtptotal5.Clear() Txtcontado.Clear() Txtcredito.Clear()

Txtnombre.Clear() Txtapellido.Clear() Txtfecha.Clear() Txtproforma.Clear() End Sub // Codificando el checkbox1

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged Txtcontado.Text = Format(Val(Txtsubtotal.Text) * 0.15, "##.00") Txttotal.Text = Format(Val(Txtsubtotal.Text) - Val(Txtcontado.Text), "##.00") If (CheckBox1.Checked = True) Then CheckBox2.Enabled = False ElseIf (CheckBox1.Checked = False) Then CheckBox2.Enabled = True CheckBox1.Enabled = False End If End Sub Codificando el checkbox2

Page 41: Ejercicios de visual

Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged Txtcredito.Text = Format(Val(Txtsubtotal.Text) * 0.2, "##.00") Txttotal.Text = Format(Val(Txtsubtotal.Text) + Val(Txtcredito.Text), "##.00") End Sub //Codificando el boton cantidad2 para sacar el precio de las impresoras

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

As System.EventArgs) Handles Txtcantidad2.TextChanged

Txtptotal2.Text = Format(Val(Txtcantidad2.Text) * Val(DATOS1), "##.00") Txtsubtotal.Text = Format(Val(Txtptotal.Text) + Val(Txtptotal2.Text) + Val(Txtptotal3.Text) + Val(Txtptotal4.Text) + Val(Txtptotal5.Text), "##.00") Txtiva.Text = Format(Val(Txtsubtotal.Text) * 0.12, "##.00") Txttotal.Text = Format(Val(Txtsubtotal.Text) + Val(Txtiva.Text), "##.00") End Sub Codificando el boton cantidad para sacar el precio de los discos duros

Private Sub Txtcantidad3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txtcantidad3.TextChanged Txtptotal3.Text = Format(Val(Txtcantidad3.Text) * Val(DATOS1), "##.00") Txtsubtotal.Text = Format(Val(Txtptotal.Text) + Val(Txtptotal2.Text) + Val(Txtptotal3.Text) + Val(Txtptotal4.Text) + Val(Txtptotal5.Text), "##.00") Txtiva.Text = Format(Val(Txtsubtotal.Text) * 0.12, "##.00") Txttotal.Text = Format(Val(Txtsubtotal.Text) + Val(Txtiva.Text), "##.00") End Sub Codificando el boton cantidad para sacar el precio de los procesadores

Private Sub Txtcantidad4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txtcantidad4.TextChanged Txtptotal4.Text = Format(Val(Txtcantidad4.Text) * Val(DATOS1), "##.00") Txtsubtotal.Text = Format(Val(Txtptotal.Text) + Val(Txtptotal2.Text) + Val(Txtptotal3.Text) + Val(Txtptotal4.Text) + Val(Txtptotal5.Text), "##.00") Txtiva.Text = Format(Val(Txtsubtotal.Text) * 0.12, "##.00") Txttotal.Text = Format(Val(Txtsubtotal.Text) + Val(Txtiva.Text), "##.00") End Sub Codificando el boton cantidad para sacar el precio de los teclados

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

System.EventArgs) Handles Txtcantidad5.TextChanged

Txtptotal5.Text = Format(Val(Txtcantidad5.Text) * Val(DATOS1), "##.00") Txtsubtotal.Text = Format(Val(Txtptotal.Text) + Val(Txtptotal2.Text) + Val(Txtptotal3.Text) + Val(Txtptotal4.Text) + Val(Txtptotal5.Text), "##.00") Txtiva.Text = Format(Val(Txtsubtotal.Text) * 0.12, "##.00") Txttotal.Text = Format(Val(Txtsubtotal.Text) + Val(Txtiva.Text), "##.00") End Sub

Page 42: Ejercicios de visual

APLICACIÓN Nº 9

TEMA: Diseñe una aplicación que me permita conocer y obtener

información de los planetas del sistema solar.

1. Abrir un nuevo Proyecto en Visual Basic

2. Apariencia del Formulario

Page 43: Ejercicios de visual

3.- COMPONENTES

FORM1 Name Form1 Windowstate Maximize

LABEL

Cantidad 2

Name Label1 Text nuestro sistema solar Name Label2 Text elegir planeta

COMBOBOX Cantidad 1 Utilizaremos el COMBOBOX para insertar la lista de planetas

PICTURE BOX Cantidad 2 Nos permitira direccionar la imagen de cada planeta segu n lo seleccionamos

BUTTON Cantidad 1 Insertamos una imagen List.

4.- Programaciòn

Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.Items.Add("tierra") ComboBox1.Items.Add("marte") ComboBox1.Items.Add("jupiter") ComboBox1.Items.Add("saturno") ComboBox1.Items.Add("mercurio") ComboBox1.Items.Add("neptuno") End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Select Case (ComboBox1.SelectedIndex) Case Is = 0

Page 44: Ejercicios de visual

TextBox1.Text = "La Tierra es un planeta del Sistema Solar que gira alrededor de su estrella en la tercera órbita más interna. Es el más denso y el quinto mayor de los ocho planetas del Sistema Solar. También es el mayor de los cuatro terrestres." PictureBox2.Load("C:\ollo\planetas\tierra.jpg") PictureBox3.Image = ImageList1.Images(0) Case Is = 1 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 dePlaneta rojo debido a la apariencia rojiza que le confiere el óxido de hierro que domina su superficie." PictureBox2.Load("C:\ollo\planetas\marte.gif") PictureBox3.Image = ImageList1.Images(1) Case Is = 2 TextBox1.Text = "Jupiter es un paneta muy lindo" PictureBox2.Load("C:\ollo\planetas\jupiter.jpg") PictureBox3.Image = ImageList1.Images(2) Case Is = 3 TextBox1.Text = "Saturno es un planeta muy grande" PictureBox2.Load("C:\ollo\planetas\saturno.jpg") PictureBox3.Image = ImageList1.Images(3) Case Is = 4 TextBox1.Text = "Mercurio es un paneta muy lindo" PictureBox2.Load("C:\ollo\planetas\mercurio.jpg") PictureBox3.Image = ImageList1.Images(4) Case Is = 5 TextBox1.Text = "Neptuno es un paneta muy lindo" PictureBox2.Load("C:\ollo\planetas\neptuno.jpg") PictureBox3.Image = ImageList1.Images(5) End Select End Sub End Class

Page 45: Ejercicios de visual

APLICACIÓN Nº 10

TEMA: 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.

1. Abrir un nuevo Proyecto en Visual Basic

2. Diseño del Formulario

Page 46: Ejercicios de visual

3. COMPONENTES

FORM1 Name Form1 Windowstate Maximize LABEL

Cantidad 3

Name Label1 Text propiedades alimenicias Checkbox Cantidad 1 Name Checkbox 1

Para desplegar la lista de opciones.

PICTURE BOX Cantidad 4 Nos permitira direccionar la imagen de cada alimento segu n lo seleccionamos

4.-PROGRAMACION

Public Class Form1

Private Sub cmdpropiedades_SelectedIndexChanged(ByVal sender As

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

cmdpropiedades.SelectedIndexChanged

Select Case (cmdpropiedades.SelectedIndex)

Case Is = 0

txt1.Text = "Los vegetales y hortalizas nos brindan

una comida de baja densidad calórica, pero rica en vitaminas y

minerales. Cuando se consumen frescas, es conveniente ajustar su

consumo a su temporada, para aprovechar todos sus micronutrientes."

PictureBox1.Image = ImageList1.Images(0)

Case Is = 1

txt1.Text = "El agua, las vitaminas antioxidantes, los

minerales, las enzimas y la fibra que contiene la fruta nos ayuda a

hidratar, depurar y vitalizar nuestro organismo. Tienen un bajo

contenido en calorías y carecen de colesterol."

PictureBox1.Image = ImageList1.Images(1)

Case Is = 2

txt1.Text = "Las cereales fueron la base alimenticia

en el nacimiento de la agricultura, y con ella, en la aparición de

grandes civilizaciones. Sus aportes nutritivos, su gran versatilidad

culinaria (para la elaboración de panes, pasta, y otros alimentos a

Page 47: Ejercicios de visual

partir de la harina de cereal) y porque su bajo contenido en agua

facilita su conservación, han determinado la importancia de los

cereales en la alimentación humana"

PictureBox1.Image = ImageList1.Images(2)

Case Is = 2

txt1.Text = "El marisco es un alimento muy importante

en la nutrición ya que es rico en proteínas, vitaminas y minerales. Y

lo mejor de todo es que apenas tiene aporte calórico y tiene muy poca

grasa, así que es ideal para dietas. Este tipo de alimento es

excelente proveedor de minerales tales como hierro, fósforo, zinc,

potasio y yodo, además de tener importantes cantidades de vitaminas A

y B"

PictureBox1.Image = ImageList1.Images(3)

Case Is = 2

txt1.Text = "Los lácteos agrupan una serie de

alimentos que dentro de su composición química poseen nutrientes que

brindan ciertas propiedades y beneficios a la salud. Fortalece los

huesos gracias a su aporte en calcio, vitamina A y D."

PictureBox1.Image = ImageList1.Images(4)

End Select

End Sub

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

System.EventArgs) Handles MyBase.Load

cmdpropiedades.Items.Add("verduras")

cmdpropiedades.Items.Add("frutas")

cmdpropiedades.Items.Add("cereales")

cmdpropiedades.Items.Add("mariscos")

cmdpropiedades.Items.Add("lacteos")

End Sub

End Class

Page 48: Ejercicios de visual

APLICACIÓN Nº 11

TEMA 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

1. Abrir un nuevo Proyecto en Visual Basic

2. Diseño del Formulario

Page 49: Ejercicios de visual

3.-COMPONENTES 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 4.- PROGRAMACION

Public Class Form1

Para validar los datos, ingresar solo letras para el cliente. 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 50: Ejercicios de visual

Para validar el ingreso de datos, que la lectura siempre sea mayor a la anterior.

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

Para calcular el costo de consumo y calcular el total a pagar adicionando los recargos .

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

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

txtbomberos.Text = Val(txtcosto.Text) * 0.04

txtbasura.Text = Val(txtcosto.Text) * 0.05

txttotal.Text = Val(txtcosto.Text) + Val(txtalumbrado.Text) +

Val(txtbomberos.Text) + Val(txtbasura.Text)

End Sub

Para validar los datos, ingresar solo números para la lectura actual.

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

Para validar los datos, ingresar solo números para la lectura anterior.

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

Para validar los datos, ingresar solo números para el # de cuenta.

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

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

If Char.IsDigit(e.KeyChar) Then

e.Handled = False

ElseIf Char.IsControl(e.KeyChar) Then

e.Handled = False

Else

Page 51: Ejercicios de visual

e.Handled = True

End If

End Sub

Para validar los datos, ingresar solo números para la factura.

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

System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.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

5.- CONCLUSION

En el programa realizado podemos observar que nos permite 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.

Page 52: Ejercicios de visual

APLICACIÓN Nº 12

TEMA: ROL DE PAGOS

1. Abrir un nuevo Proyecto en Visual Basic

2. Diseño del Formulario

Page 53: Ejercicios de visual

3.-COMPONENTES

FORM

cantidad 1

Form1 para el rol de pagos

PICTUREBOX

cantidad 1

picturebox1 = para poner una imagen en el form2 para la clave

LABEL

Cantidad 18

Name label1

Text=para ingresar el nombre del usuario

Name label2

Text= para ingresar la ocntraseña del usuario

Name label3

Text= para ingresar la cedula del empleado

Name label4

Text= para ingresar el nombre del cargo

Name label5

Text= para ingresar el teléfono

Name label6

Text= para ingresar el sueldo

Name label7

Text= para ingresar la dirección

Name label8

Text= para ingresar el iess

Name label9

Text= para ingresar las multas

Name label10

Text= para ingresar el teléfono

Page 54: Ejercicios de visual

Name label11

Text=para calcular el descuento de las multas

Name label12

Text=para ingresar el número de las horas extras

Name label13

Text=para calcular el total de las horas extras

Name label14

Text=para ingresar el número de cargo familiar

Name label15

Text=para calcular el total del cargo familiar

Name label16

Text para calcular el total de ingresos

Name label17

Text=el total de egresos

Name label18

Text=total a recibir

BUTTON

cantidad 6

button1 = para ingresar al siguiente formulario button2= para calcular total de ingresos button3 = para calcular total de egresos button4= para iniciar otra persona button5=para borrar y ingresar un nuevo datos button6= para salir de la ejecución

CHEKBOX

Cantidad 1

Chekbox 1 = para seleccionar si tiene préstamo o no

Page 55: Ejercicios de visual

4.-PROGRAMACION

CLAVE

If txtclave.Text = ("PAGOS") Then

Form1.Show()

Me.Hide()

Else

MsgBox("CONTRASEÑA INVALIDA")

txtclave.Focus()

txtclave.SelectionStart = 0

txtclave.Text = ""

End If

CODIFICADO PARA EL ROL DE PAGOS

Public Class Form1

Dim DATOS, aux, con As Integer

Dim DATOS1 As Double

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As

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

ComboBox1.SelectedIndexChanged

DATOS = ComboBox1.SelectedIndex

If (DATOS = 0) Then

txtcedula.Text = "1804758963"

txtcargo.Text = "GERENTE"

txtsueldo.Text = Val("400")

DATOS1 = txtsueldo.Text

ElseIf (DATOS = 1) Then

txtcedula.Text = "1804785961"

txtcargo.Text = "SECRETARIA"

txtsueldo.Text = Val("320.50")

DATOS1 = txtsueldo.Text

ElseIf (DATOS = 2) Then

txtcedula.Text = "1307845219"

txtcargo.Text = "MENSAJERO"

txtsueldo.Text = Val("100")

DATOS1 = txtsueldo.Text

ElseIf (DATOS = 3) Then

txtcedula.Text = Val("1054785445")

txtcargo.Text = "ADMINISTRADOR"

txtsueldo.Text = Val("220")

DATOS1 = txtsueldo.TexT

ElseIf (DATOS = 4) Then

txtcedula.Text = Val("1084512589")

txtcargo.Text = "CONTADOR"

txtsueldo.Text = Val("350.50")

DATOS1 = txtsueldo.Text

ElseIf (DATOS = 5) Then

txtcedula.Text = Val("1087451045")

txtcargo.Text = "VENDEDOR"

txtsueldo.Text = Val("150")

DATOS1 = txtsueldo.Text

End If

End Sub

Page 56: Ejercicios de visual

Private Sub txtdirec_KeyPress(ByVal sender As Object, ByVal

e As System.Windows.Forms.KeyPressEventArgs) Handles

txtdirec.KeyPress

If Char.IsLetter(e.KeyChar) Then

e.Handled = False

ElseIf Char.IsControl(e.KeyChar) Then

e.Handled = False

ElseIf Char.IsSeparator(e.KeyChar) Then

e.Handled = False

Else

e.Handled = True

End If

End Sub

Private Sub txttele_KeyPress(ByVal sender As Object, ByVal e

As System.Windows.Forms.KeyPressEventArgs) Handles

txttele.KeyPress

If Char.IsDigit(e.KeyChar) Then

e.Handled = False

ElseIf Char.IsControl(e.KeyChar) Then

e.Handled = False

Else

e.Handled = True

End If

End Sub

Private Sub txtextras_KeyPress(ByVal sender As Object, ByVal

e As System.Windows.Forms.KeyPressEventArgs) Handles

txtextras.KeyPress

If Char.IsDigit(e.KeyChar) Then

e.Handled = False

ElseIf Char.IsControl(e.KeyChar) Then

e.Handled = False

Else

e.Handled = True

End If

End Sub

Private Sub txttofami_TextChanged(ByVal sender As

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

txttofami.TextChanged

End Sub

Private Sub txtextras_TextChanged(ByVal sender As

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

txtextras.TextChanged

If Val(txtextras.Text) >= 1 And Val(txtextras.Text) <=

10 Then

aux = Val(txtsueldo.Text) * 6 / 100

txthextras.Text = Val(txtextras.Text) * aux

Else

MsgBox("Numero Invalido")

End If

End Sub

Private Sub txtfami_TextChanged(ByVal sender As

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

txtfami.TextChanged

If Val(txtfami.Text >= 2) Then

txttofami.Text = Format(Val(txtfami.Text) * 10.5,

"###.00")

Page 57: Ejercicios de visual

Else

txttofami.Text = Format(Val(txtfami.Text) * 15.5, "###.00")

End If

End Sub

Private Sub TextBox1_TextChanged_1(ByVal sender As

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

txtmultas.TextChanged

If Val(txttomultas.Text) >= 7 Then

txttomultas.Text = Val(txtsueldo.Text) * 20 / 100

Else

txttomultas.Text = Val(txtmultas.Text) * 3

End If

End Sub

Private Sub TextBox1_TextChanged_2(ByVal sender As

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

txtprestamos.TextChanged

If Val(txtprestamos.Text) = 6 Then

con = Val(txtmonto.Text) * 8 / 100

txtvalpresta.Text = Format((Val(txtmonto.Text) +

con) / 6, "###.00")

ElseIf Val(txtprestamos.Text) = 12 Then

con = (Val(txtmonto.Text) * 16 / 100)

txtvalpresta.Text = Format((Val(txtmonto.Text) +

con) / 12, "###.00")

ElseIf Val(txtprestamos.Text) = 18 Then

con = (Val(txtmonto.Text) * 20 / 100)

txtvalpresta.Text = Format((Val(txtmonto.Text) +

con) / 18, "###.00")

End If

End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As

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

CheckBox1.CheckedChanged

txtprestamos.Visible = True

txtmonto.Visible = True

txtvalpresta.Visible = True

End Sub

Private Sub txtsueldo_TextChanged(ByVal sender As

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

txtsueldo.TextChanged

txtiees.Text = Format(Val(txtsueldo.Text) * 11.5 / 100,

"###.00")

End Sub

Private Sub txttorecibe_Click(ByVal sender As Object, ByVal

e As System.EventArgs) Handles txttorecibe.Click

txttorecibe.Text = Format(Val(txtingres.Text) -

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

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As

System.Object, ByVal e As System.EventArgs)

End Sub

Page 58: Ejercicios de visual

Private Sub Button1_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Button1.Click

End

End Sub

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

e As System.EventArgs) Handles Button2.Click

Form2.Show()

Me.Hide()

End Sub

Private Sub txtegresos_TextChanged(ByVal sender As

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

txtegresos.TextChanged

End Sub

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

e As System.EventArgs) Handles Button3.Click

txtegresos.Text = Format(Val(txtiees.Text) +

Val(txttomultas.Text) + Val(txtvalpresta.Text), "###.00")

End Sub

Private Sub Button4_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Button4.Click

txtingres.Text = Format(Val(txtsueldo.Text) +

Val(txthextras.Text) + Val(txttofami.Text), "##.00")

End Sub

Private Sub Button5_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Button5.Click

txtdirec.Text = ""

txttele.Text = ""

txtingres.Text = ""

txtegresos.Text = ""

txtiees.Text = ""

txtmonto.Text = ""

txtprestamos.Text = ""

txtmultas.Text = ""

txttomultas.Text = ""

txtcargo.Text = ""

txttofami.Text = ""

txtsueldo.Text = ""

txtcargo.Text = ""

txtfami.Text = ""

txtextras.Text = ""

txttorecibe.Text = ""

txtsueldo.Text = ""

txthextras.Text = ""

txtvalpresta.Text = ""

txttorecibe.Text = ""

End Sub

End Class

5.-CONCLUSION Mediante esta aplicación podemos obtener la automatizacion de pago para cada empleado

de una empresa.

Page 59: Ejercicios de visual

APLICACIÓN Nº 13

TEMA: 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.

1. Abrir un nuevo Proyecto en Visual Basic

2. Diseño del Formulario

Page 60: Ejercicios de visual

3.- Componentes

FORM cantidad 1 Name From1

Combobox Cantidad 2 Name combIns Name combtipo

LABEL Cantidad 15 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

Textbox Cantidad 10 Textbox1=txtnombre Textbox2=txtapellido Textbox3=txtcedula Textbox4=txtdireccion Textbox5=txttelefono Textbox6= txtvmatricula Textbox7= txtsmedico Textbox8= txtsinternet Textbox9= txtsrecreacion Textbox10= txttotal

Button Cantidad 2 Button1=salir Button2=nuevo

Page 61: Ejercicios de visual

4.-Programacion Public Class Form1

Dim dato As Integer

Private Sub NOMBRE_KeyPress(ByVal sender As Object, ByVal e

As System.Windows.Forms.KeyPressEventArgs) Handles

txtNOMBRE.KeyPress

If Char.IsNumber(e.KeyChar) Then

e.Handled = True

MsgBox("NO DATOS NUMERICOS")

txtNOMBRE.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

txtAPELLIDO.KeyPress

If Char.IsNumber(e.KeyChar) Then

e.Handled = True

MsgBox("NO DATOS NUMERICOS")

txtAPELLIDO.Focus()

ElseIf Char.IsControl(e.KeyChar) Then

e.Handled = False

Else

e.Handled = False

End If

End Sub

Private Sub CEDULA_KeyPress(ByVal sender As Object, ByVal e

As System.Windows.Forms.KeyPressEventArgs) Handles

txtCEDULA.KeyPress

If Char.IsLetter(e.KeyChar) Then

e.Handled = False

MsgBox("SOLO DATOS NUMERICOS")

txtCEDULA.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

txtTELEFONO.KeyPress

If Char.IsLetter(e.KeyChar) Then

e.Handled = False

MsgBox("SOLO DATOS NUMERICOS")

txtTELEFONO.Focus()

ElseIf Char.IsControl(e.KeyChar) Then

Page 62: Ejercicios de visual

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

txtVMATRICULA.TextChanged

End Sub

Private Sub TIPO_SelectedIndexChanged(ByVal sender As

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

cmbTIPO.SelectedIndexChanged

dato = cmbTIPO.SelectedIndex

If dato = 0 Then

txtVMATRICULA.Text = "250"

txtSMEDICO.Text = Format(Val(txtVMATRICULA.Text *

0.09), "##, 00")

txtSINTERNET.Text = Format(Val(txtVMATRICULA.Text *

0.1), "##,00")

txtSRECREACION.Text = Format(Val(txtVMATRICULA.Text

* 0.12), "##,00")

txtTOTAL.Text = Format(Val(txtVMATRICULA.Text) +

Val(txtSMEDICO.Text) + Val(txtSINTERNET.Text) +

Val(txtSRECREACION.Text) + 5, "##,00")

ElseIf dato = 1 Then

txtVMATRICULA.Text = "120"

txtSMEDICO.Text = Format(Val(txtVMATRICULA.Text *

0.06), "##, 00")

txtSINTERNET.Text = Format(Val(txtVMATRICULA.Text *

0.08), "##,00")

txtSRECREACION.Text = Format(Val(txtVMATRICULA.Text

* 0.1), "##,00")

txtTOTAL.Text = Format(Val(txtVMATRICULA.Text) +

Val(txtSMEDICO.Text) + Val(txtSINTERNET.Text) +

Val(txtSRECREACION.Text) + 5, "##,00")

ElseIf dato = 2 Then

txtVMATRICULA.Text = "180"

txtSMEDICO.Text = Format(Val(txtVMATRICULA.Text *

0.08), "##, 00")

txtSINTERNET.Text = Format(Val(txtVMATRICULA.Text *

0.09), "##,00")

txtSRECREACION.Text = Format(Val(txtVMATRICULA.Text

* 0.11), "##,00")

txtTOTAL.Text = Format(Val(txtVMATRICULA.Text) +

Val(txtSMEDICO.Text) + Val(txtSINTERNET.Text) +

Val(txtSRECREACION.Text) + 5, "##,00")

End If

End Sub

Page 63: Ejercicios de visual

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

e As System.EventArgs) Handles MyBase.Load

cmbTIPO.Items.Add("PARTICULAR")

cmbTIPO.Items.Add("FISCAL")

cmbTIPO.Items.Add("FISCOMISIONAL")

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

cmbCOLEGIO.Items.Add("GUAYAQUIL")

cmbCOLEGIO.Items.Add("BOLIVAR")

cmbCOLEGIO.Items.Add("LA SALLE")

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

cmbCOLEGIO.Items.Add("ADVENTISTA")

cmbCOLEGIO.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

txtNOMBRE.Text = ""

txtAPELLIDO.Text = ""

txtTELEFONO.Text = ""

txtDIRECCIÓN.Text = ""

txtVMATRICULA.Text = ""

cmbTIPO.Text = ""

cmbCOLEGIO.Text = ""

txtSINTERNET.Text = ""

txtSMEDICO.Text = ""

txtSRECREACION.Text = ""

txtTOTAL.Text = ""

End Sub

Page 64: Ejercicios de visual

Realizar un programa que permita realizar el control de notas

de los estudiantes

1. Abrir un nuevo Proyecto en Visual Basic

2. Diseño del Formulario

Page 65: Ejercicios de visual

3.- Componenentes

FORM cantidad 1 Name From1

Combobox Cantidad 1 Name combSemestre

LABEL Cantidad 15 Label1=control de notas Label2=Nombre Label3=Semestre Label4=Nota1 Label5=Nota2 Label6=Nota3 Label7=Promedio Label8=Equivalencia Label9=Modulos Label10=General BUTTON Cantidad1 Name Button1 Text calcular

Page 66: Ejercicios de visual

5. - Programacion

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

lblmateria1.Text = " FISICA II"

lblmateria2.Text = " TUTORIAS"

lblmateria3.Text = " PROGRAMACIONI"

lblmateria4.Text = " TRABALO EN EQUIPO"

lblmateria5.Text = " MATEMATICA BASICA"

lblmateria6.Text = " METODOLOGIA DE LA INVESTIGACION"

Case Is = 1

lblmateria1.Text = " MODELOS PEDAGOGICOS"

lblmateria2.Text = " MATEMATICA AVANZADA"

lblmateria3.Text = " PSICOLOGIA GENERAL"

lblmateria4.Text = " ELECTRONICA"

lblmateria5.Text = " PROGRAMACION II"

lblmateria6.Text = " ARQUITECTURA MANTENIMIENTO I"

Case Is = 2

lblmateria1.Text = " LENGUAJE PROGRAMACION I"

lblmateria2.Text = " HERRAMIENTAS MULTIMEDIA"

lblmateria3.Text = " PROBLEMAS DE APRENDIZAJE"

lblmateria4.Text = " PLANIFICACION CURRICULAR"

lblmateria5.Text = " GESTOR BASE DE DATOS"

lblmateria6.Text = " ARQUITECTURA MANTENIMIENTO II"

Case Is = 3

lblmateria1.Text = " PRACTICAS PREPROFESIONALES"

lblmateria2.Text = " SISTEMAS OPERATIVOS"

lblmateria3.Text = " PROGRAMACION WEB 1 "

lblmateria4.Text = " REDES"

lblmateria5.Text = " SISTEMATIZACION CONTABLE"

lblmateria6.Text = " GESTION DE PROYECTOS"

End Select

End Sub

Private Sub txtmnota3_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtmnota3.TextChanged

If Val(txtmnota3.Text) >= 1 And Val(txtmnota3.Text) <= 10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmnota3.Text = " "

End If

txtpro1.Text = Format((Val(txtmnota1.Text) +

Val(txtmnota2.Text) + Val(txtmnota3.Text)) / 3, "##.00")

If Val(txtpro1.Text) >= 7 Then

txtequi1.Text = "APROBADO"

ElseIf Val(txtpro1.Text) >= 5 And Val(txtpro1.Text) <= 7 Then

txtequi1.Text = "SUSPENSO"

ElseIf Val(txtpro1.Text) < 5 Then

txtequi1.Text = "REPROBADO"

End If

Page 67: Ejercicios de visual

End Sub

Private Sub txtmanota3_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtmanota3.TextChanged

If Val(txtmanota3.Text) >= 1 And Val(txtmanota3.Text) <= 10

Then

Else

MsgBox("VALOR INCORRECTO")

txtmanota3.Text = " "

End If

txtpro2.Text = Format((Val(txtmanota1.Text) +

Val(txtmanota2.Text) + Val(txtmanota3.Text)) / 3, "##.00")

If Val(txtpro2.Text) >= 7 Then

txtequi2.Text = "APROBADO"

ElseIf Val(txtpro2.Text) >= 5 And Val(txtpro2.Text) <= 7 Then

txtequi2.Text = "SUSPENSO"

ElseIf Val(txtpro2.Text) < 5 Then

txtequi2.Text = "REPROBADO"

End If

End Sub

Private Sub txtmatnota3_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtmatnota3.TextChanged

If Val(txtmatnota3.Text) >= 1 And Val(txtmatnota3.Text) <= 10

Then

Else

MsgBox("VALOR INCORRECTO")

txtmatnota3.Text = " "

End If

txtpro3.Text = Format((Val(txtmatnota1.Text) +

Val(txtmatnota2.Text) + Val(txtmatnota3.Text)) / 3, "##.00")

If Val(txtpro3.Text) >= 7 Then

txtequi3.Text = "APROBADO"

ElseIf Val(txtpro3.Text) >= 5 And Val(txtpro3.Text) <= 7 Then

txtequi3.Text = "SUSPENSO"

ElseIf Val(txtpro3.Text) < 5 Then

txtequi3.Text = "REPROBADO"

End If

End Sub

Private Sub txtmatenota3_TextChanged(ByVal sender As

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

txtmatenota3.TextChanged

If Val(txtmatenota3.Text) >= 1 And Val(txtmatenota3.Text) <=

10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmatenota3.Text = " "

End If

txtpro4.Text = Format((Val(txtmatenota1.Text) +

Val(txtmatenota2.Text) + Val(txtmatenota3.Text)) / 3, "##.00")

If Val(txtpro4.Text) >= 7 Then

txtequi4.Text = "APROBADO"

ElseIf Val(txtpro4.Text) >= 5 And Val(txtpro4.Text) <= 7 Then

txtequi4.Text = "SUSPENSO"

ElseIf Val(txtpro4.Text) < 5 Then

Page 68: Ejercicios de visual

txtequi4.Text = "REPROBADO"

End If

End Sub

Private Sub txtmaternota3_TextChanged(ByVal sender As

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

txtmaternota3.TextChanged

If Val(txtmaternota3.Text) >= 1 And Val(txtmaternota3.Text) <=

10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmaternota3.Text = " "

End If

txtpro5.Text = Format((Val(txtmaternota1.Text) +

Val(txtmaternota2.Text) + Val(txtmaternota3.Text)) / 3, "##.00")

If Val(txtpro5.Text) >= 7 Then

txtequi5.Text = "APROBADO"

ElseIf Val(txtpro5.Text) >= 5 And Val(txtpro5.Text) <= 7 Then

txtequi5.Text = "SUSPENSO"

ElseIf Val(txtpro5.Text) < 5 Then

txtequi5.Text = "REPROBADO"

End If

End Sub

Private Sub txtmaterinota3_TextChanged(ByVal sender As

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

txtmaterinota3.TextChanged

If Val(txtmaterinota3.Text) >= 1 Or Val(txtmaterinota3.Text)

<= 10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmaterinota3.Text = " "

End If

txtpro6.Text = Format((Val(txtmaterinota1.Text) +

Val(txtmaterinota2.Text) + Val(txtmaterinota3.Text)) / 3, "##.00")

If Val(txtpro6.Text) >= 7 Then

txtequi6.Text = "APROBADO"

ElseIf Val(txtpro6.Text) >= 5 And Val(txtpro6.Text) <= 7 Then

txtequi6.Text = "SUSPENSO"

ElseIf Val(txtpro6.Text) < 5 Then

txtequi6.Text = "REPROBADO"

End If

End Sub

Private Sub txtmnota1_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtmnota1.TextChanged

If Val(txtmnota1.Text) >= 1 And Val(txtmnota1.Text) <= 10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmnota1.Text = " "

End If

End Sub

Page 69: Ejercicios de visual

Private Sub txtmnota2_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtmnota2.TextChanged

If Val(txtmnota2.Text) >= 1 And Val(txtmnota2.Text) <= 10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmnota2.Text = " "

End If

End Sub

Private Sub txtmanota1_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtmanota1.TextChanged

If Val(txtmanota1.Text) >= 1 And Val(txtmanota1.Text) <= 10

Then

Else

MsgBox("VALOR INCORRECTO")

txtmanota1.Text = " "

End If

End Sub

Private Sub txtmanota2_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtmanota2.TextChanged

If Val(txtmanota2.Text) >= 1 And Val(txtmanota2.Text) <= 10

Then

Else

MsgBox("VALOR INCORRECTO")

txtmanota2.Text = " "

End If

End Sub

Private Sub txtmatnota1_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtmatnota1.TextChanged

If Val(txtmatnota1.Text) >= 1 And Val(txtmatnota1.Text) <= 10

Then

Else

MsgBox("VALOR INCORRECTO")

txtmatnota1.Text = " "

End If

End Sub

Private Sub txtmatnota2_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtmatnota2.TextChanged

If Val(txtmatnota2.Text) >= 1 And Val(txtmatnota2.Text) <= 10

Then

Else

MsgBox("VALOR INCORRECTO")

txtmatnota2.Text = " "

End If

End Sub

Page 70: Ejercicios de visual

Private Sub txtmatenota1_TextChanged(ByVal sender As

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

txtmatenota1.TextChanged

If Val(txtmatenota1.Text) >= 1 And Val(txtmatenota1.Text) <=

10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmatenota1.Text = " "

End If

End Sub

Private Sub txtmatenota2_TextChanged(ByVal sender As

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

txtmatenota2.TextChanged

If Val(txtmatenota2.Text) >= 1 And Val(txtmatenota2.Text) <=

10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmatenota2.Text = " "

End If

End Sub

Private Sub txtmaternota1_TextChanged(ByVal sender As

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

txtmaternota1.TextChanged

If Val(txtmaternota1.Text) >= 1 And Val(txtmaternota1.Text) <=

10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmaternota1.Text = " "

End If

End Sub

Private Sub txtmaternota2_TextChanged(ByVal sender As

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

txtmaternota2.TextChanged

If Val(txtmaternota2.Text) >= 1 And Val(txtmaternota2.Text) <=

10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmaternota2.Text = " "

End If

End Sub

Private Sub txtmaterinota1_TextChanged(ByVal sender As

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

txtmaterinota1.TextChanged

If Val(txtmaterinota1.Text) >= 1 And Val(txtmaterinota1.Text)

<= 10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmaterinota1.Text = " "

Page 71: Ejercicios de visual

End If

End Sub

Private Sub txtmaterinota2_TextChanged(ByVal sender As

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

txtmaterinota2.TextChanged

If Val(txtmaterinota2.Text) >= 1 And Val(txtmaterinota2.Text)

<= 10 Then

Else

MsgBox("VALOR INCORRECTO")

txtmaterinota2.Text = " "

End If

End Sub

Private Sub txtpro3_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtpro3.TextChanged

End Sub

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

As System.EventArgs) Handles Button1.Click

txtproge.Text = Format((Val(txtpro1.Text) + Val(txtpro2.Text)

+ Val(txtpro3.Text) + Val(txtpro4.Text) + Val(txtpro5.Text) +

Val(txtpro6.Text)) / 6, "##.00")

If Val(txtproge.Text) >= 7 Then

txtequito.Text = "APROBADO"

ElseIf Val(txtproge.Text) >= 5 And Val(txtproge.Text) <= 7

Then

txtequito.Text = "SUSPENSO"

ElseIf Val(txtproge.Text) < 5 Then

txtequito.Text = "REPROBADO"

End If

End Sub

Page 72: Ejercicios de visual
Page 73: Ejercicios de visual

3.- COMPONENTES

FORM Cantidad 2 Name from1 PICTUREBOX Cantidad 1 PictureBox1=imagen del auto GROUPBOX cantidad 3 GroupBox1=Datos personales GroupBox2=Datos del vehículo GroupBox3=Valores totales

LABEL Cantidad 19 Label1= Tema Label2=Código Label3= Nombre Label4= Apellido Label5=Cedula Label6=Dirección Label7=Teléfono Label8=Tipo de vehículo Label9=Valor Label10=Color Label11=Aire acondicionado Label12= Vidrios eléctricos Label13= Valor de venta Label14=Comisión vendedor Label15= Total comisión Label16=Total a pagar TEXTOX Cantidad 10 Textbox1=txtnombres Textbox2=txtapellido Textbox3=txtcedula Textbox4=txtdireccion Textbox4=txttelefono Textbox5=txttvehiculo

Page 74: Ejercicios de visual

Textbox6=txtvalor Textbox7=txtvalventa Textbox8=txtcomvendedor Textbox9=txttotcomision Textbox10=txttotpagar COMBOBOX Cantidad 5 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 Button Cantidad 3 Button1= Para Nuevo Button2= Para Añadir Venta Button3= Para Salir

4.- Programacion

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As

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

cmbcodigo.SelectedIndexChanged

Select Case (cmbcodigo.SelectedIndex)

Case Is = 0

txtnombre.Text = "Maria Emitelia"

txtapellido.Text = "Rosero Rosero"

txtci.Text = "1802456989"

txtdirec.Text = "Ambato"

txttelef.Text = "2825898"

Case Is = 1

txtnombre.Text = "Milto Gabriel "

txtapellido.Text = "Pallo Real"

txtci.Text = "1808856569"

txtdirec.Text = "Quito"

txttelef.Text = "0988623569"

Case Is = 2

txtnombre.Text = "Celso Anibal"

txtapellido.Text = "Jarrin Urrutia"

txtci.Text = "1801112532"

txtdirec.Text = "Riobamba"

txttelef.Text = "0999562254"

End Select

End Sub

Page 75: Ejercicios de visual

(CODIFICACION DEL SEGUNDO COMBOBOX)

Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As

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

cmbcarro.SelectedIndexChanged

Select Case (cmbcarro.SelectedIndex)

Case Is = 0

txtpresio.Text = 22000.0

PictureBox2.Load("C:\PRUEBA\camioneta.jpg")

If Val(txtpresio.Text) >= 22000 And

Val(txtpresio.Text) <= 25000 Then

txtvalorv.Text = Val(txtpresio.Text)

txtcomi.Text = Val(txtvalorv.Text) * 0.04

End If

txttotal.Text = Val(txtcomi.Text) +

Val(txttotal.Text)

txttapagar.Text = Val(txttotal.Text) +

Val(txttapagar.Text)

Case Is = 1

txtpresio.Text = 25000.0

PictureBox2.Load("C:\PRUEBA\auto.jpg")

If Val(txtpresio.Text) >= 22000 And

Val(txtpresio.Text) <= 25000 Then

txtvalorv.Text = Val(txtpresio.Text)

txtcomi.Text = Val(txtvalorv.Text) * 0.04

End If

txttotal.Text = Val(txtcomi.Text) +

Val(txttotal.Text)

txttapagar.Text = Val(txttotal.Text) +

Val(txttapagar.Text)

Case Is = 2

txtpresio.Text = 35000.0

PictureBox2.Load("C:\PRUEBA\furgon.jpg")

If Val(txtpresio.Text) > 25000 And

Val(txtpresio.Text) <= 35000 Then

txtvalorv.Text = Val(txtpresio.Text)

txtcomi.Text = Val(txtvalorv.Text) * 0.05

End If

txttotal.Text = Val(txtcomi.Text) +

Val(txttotal.Text)

txttapagar.Text = Val(txttotal.Text) +

Val(txttapagar.Text)

End Select

End Sub

(CODIFICACION DEL TERCER COMBOBOX)

Private Sub cmbcolor_SelectedIndexChanged(ByVal sender As

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

cmbcolor.SelectedIndexChanged

Select Case (cmbcolor.SelectedIndex)

Case Is = 0

PictureBox1.Load("C:\PRUEBA\negro.jpg")

Case Is = 1

PictureBox1.Load("C:\PRUEBA\blanco.jpg")

Page 76: Ejercicios de visual

Case Is = 2

PictureBox1.Load("C:\PRUEBA\gris.jpg")

Case Is = 3

PictureBox1.Load("C:\PRUEBA\rojo.jpg")

Case Is = 4

PictureBox1.Load("C:\PRUEBA\azul.jpg")

End Select

End Sub

(CODIFICACION DEL BOTTON1)

Private Sub cmdlimpiar_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles cmdlimpiar.Click

txtnombre.Text = ""

txtapellido.Text = ""

txtci.Text = ""

txtdirec.Text = ""

txttelef.Text = ""

txtvalorv.Text = ""

txtcomi.Text = ""

txttotal.Text = ""

cmbcarro.Text = ""

cmbcodigo.Text = ""

cmbaire.Text = ""

cmbcolor.Text = ""

cmbvidrio.Text = ""

(CODIFICACION DEL BOTTON2)

Private Sub cmdañadir_Click(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles cmdañadir.Click

txtcomi.Text = ""

txtvalorv.Text = ""

cmbaire.Text = ""

cmbcolor.Text = ""

cmbvidrio.Text = ""

cmbcarro.Text = ""

txtpresio.Text = ""

PictureBox1.Load("C:\PRUEBA\blanco.jpg")

PictureBox2.Load("C:\PRUEBA\blanco.jpg")

(CODIFICACION DEL BOTTON3)

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

As System.EventArgs) Handles Button1.Click

End

End Sub

Page 77: Ejercicios de visual

APLICACIÓN Nº 16

TEMA: EXAMEN DEL PARCIAL

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 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. Examen.

Utilizaremos un tabcontrol para realizar nuestro programa de forma

adecuada y ordenada.

Utilizaremos dos botones para el blanqueamiento y salir de todo el

programa.

Page 78: Ejercicios de visual

1. Abrir un nuevo Proyecto en Visual Basic

2. Diseño del Formulario

Nuestro primer formulario de Bienvenida al sistema

El segundo formulario esta diseñado con un Tabcontrol que divide el

Formulario.

Page 79: Ejercicios de visual

En estudios realizados podemos observar la diferentes opciones que

tenemos para elegir.

Al final obtenemos todas las condiciones que pide en el examen

Page 80: Ejercicios de visual

3.- Componentes

Form Cantidad 2 Name Form1

LABEL Cantidad 24 Label1= tema del examen

Label2=nombre

Label3=dirección

Label4= cedula

Label5=teléfono

Label6=detalle

Label7=tipo

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

Textbox

Cantidad 25

Textbox1=txtnombres

Textbox2=txtdireccion

Textbox3=cedula

Textbox4=txttelefono

Textbox5=txttitulo

Textbox6=txtmeri

Textbox7=txtvpubli

Textbox8=txtvidio

Page 81: Ejercicios de visual

Textbox9=txtproyec

Textbox10=txtitotal

Textbox11=txtmertotal

Textbox12=txtpublitotal

Textbox13=txtidiototal

Textbox14=txtproyetotal

Textbox15=txtpuntos

Textbox16=txtescala

Textbox17=txtsueldo

Textbox18=txtn1

Textbox19=txtn2

Textbox20=txtn3

Textbox21=txtn4

Textbox22=txtn5

Textbox23=txtsuel1

Textbox24=txtsuel2

Textbox25=txtsuel3

Textbox26=txtsuel4

Textbox27=txtsuel5

Combobox

Cantidad 5

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 realiazados

4.- Programacion

Public Class Form1

CODIFICACION DEL PRIMER COMBOBOX)

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

Page 82: Ejercicios de visual

(CODIFICACION DEL SEGUNDO COMBOBOX)

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

+++++++++++++++++++++++++++++++++++++++++++++++++++++

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

(CODIFICACION DEL QUINTO COMBOBOX Y TAMBIEN CODIFICAREMOS PARA EL QUE

SE VISUALIZE EL PRECIO TOTAL Y LA ESCALA DE PUNTOS)

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

Page 83: Ejercicios de visual

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)

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

(BLANQUEAMIENTO DE LOS TEXTBOX)

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 = ""

Page 84: Ejercicios de visual

ComboBox5.Text = ""

txtpuntos.Text = ""

txtsueldo.Text = ""

txtescala.Text = ""

txtnombres.Text = ""

txtcedula.Text = ""

txtdireccion.Text = ""

txttelefono.Text = ""

End Sub

++++SALIR+++

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

As System.EventArgs) Handles Button2.Click

End

End Sub

Private Sub txtnombres_TextChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles txtnombres.TextChanged

End Sub

End Class

Page 85: Ejercicios de visual

APLICACIÓN Nº 18

TEMA: Diseñe una Base de Datos en Access que tenga conexión con

Visual Basic

1. Para que nuestra base de daos tenga conexión con nuestra aplicación en visual debemos seguir esos pasos detenidamente.

Creamos una carpeta en la unidad C para guardar nuestra base de

datos y nuestra aplicación de visual.

Abrimos Access creamos nuestra Base y la guardamos de tipo

2002_2003.

Creamos una tabla en este caso con los Datos Personales

Guardamos todo.

Abrimos Visual Basic

Damos el nombre al Formulario.

Luego nos dirigimos al Menú Herramientas ->Opciones-> Proyectos

y Soluciones -> Activamos Mostrar configuraciones de generación

avanzada Aceptar.

Después vamos a generar -> Opciones de Configuración en

plataforma -> Nueva y ahí cambiamos de x64 a x86.

Una vez realizado el cambio Guardamos primero todo el proyecto

direccionado a la misma carpeta que creamos la Base de Datos.

Page 86: Ejercicios de visual

2. Diseño del Formulario

Aquí nos muestra la conexión con Access en visual

Este formulario es de los reporte ya determinado

Page 87: Ejercicios de visual

3. Componentes

Form Cantidad 2 Name Form1 Entrada

Name Form2 Reporte

Label

Cantidad 4

Label1=Cedula

Label2= Nombre

Label1= Apellido

Label1= Edad

TextBox

Cantidad 4

TextBox1= Txtcedula

TextBox2=Txtnombre

TextBox3=Txtapellido

TextBox4=Txtedad

Button

Cantidad1

Button1= Reporte (cmdreporte)

DataGridView1

DataGridView1= DatosBindingSource1

1 CrystalReportViewer1

CrystalReportViewer1= Reporte

4.- Programacion 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

Page 88: Ejercicios de visual

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. Me.DATOSTableAdapter.Fill(Me.Database1DataSet.DATOS) End Sub +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Reporte.Show() End Sub

End Class

Page 89: Ejercicios de visual

DOCENCIA EN INFORMATICA

DOCENCIA EN INFORMATICA

Page 90: Ejercicios de visual

Cuando crea una nueva base de datos, suele empezar creando unos cuantos objetos de base de datos como tablas, formularios e informes. Finalmente, llega a un punto en que necesita agregar alguna programación para automatizar ciertos procesos y mantener agrupados los objetos de base de datos. Este artículo proporciona orientación al usuario sobre las herramientas de programación en Microsoft Office Access 2007 y destaca algunos recursos en los que se puede obtener más información acerca de la programación.

Qué es la programación

En Office Access 2007, la programación es el proceso de agregar funcionalidad a la base de datos mediante el uso de macros de Access o código de Visual Basic para Aplicaciones (VBA). Por ejemplo, suponga que ha creado un formulario y un informe y desea agregar un botón de comando al formulario que, cuando se haga clic en él, abra el informe. En este caso, la programación es el proceso de crear una macro o un procedimiento de VBA y establecer a continuación la propiedad de eventoOnClick del botón de comando de manera que, al hacer clic en el botón de comando, se ejecute la macro o el procedimiento. En el caso de una operación sencilla, como abrir un informe, puede usar el Asistente para botones de comando para que realice todo el trabajo, o puede desactivarlo y realizar la programación usted mismo.

Page 91: Ejercicios de visual

APLICACIÓN Nº 20

TEMA: 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.

1.- 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.

2.-Aca 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.

Page 92: Ejercicios de visual

3.- Ya grabado todos nuestros datos en Access nos dirigimos a abrir el programa visual net el cual también lo guardamos en nuestra carpeta ya realizada

4.- Ya abierto el visual net nos dirigimos a la pestaña proyecto y escogemos la

opción formulario de inicio este nos permite ponerle la inicio una clave ya que este

ya viene diseñado.

6.- Nos dirigimos a el botón de aceptar dándole doble clic nos dirigirá a un

programador, acá tenemos que programar para que nos coja la contraseña que

nosotros queramos.

Page 93: Ejercicios de visual

7.- ya programado la contraseña nos dirigimos a crear otro formulario ya que en

este tiene que estar el menú principal de nuestro programa, primero tenemos que

irnos a nuestras herramienta y elegir la opción MenuStrip

8.- Acá nos saldrá esta ventanitas, en estas ventanas podremos poner nuestro

menú

9.- Acá ya puesto tono nuestro menú tenemos que programarle para que al

presionar una ventana se nos dirija a lo que nos está pidiendo

Page 94: Ejercicios de visual

10.-Este es su codificado para que se dirija a nuestro ingreso de datos

11.- este es el codificado para que se nos dirija a nuestro informe o detalle

12.- este es el codificado para que se salga de nuestro programa

Page 95: Ejercicios de visual

13.- este es su codificado para que se nos dirija nuestro reporte

14.-Despues de haber creado nuestro menú comenzamos hacer nuestro reporte y

empezamos creando otro formulario acá tenemos que dirigirnos a proyecto y

escogemos la opción agregar nuevo elemento y nos saldrá la siguiente ventana

Page 96: Ejercicios de visual

15.- Acá tenemos darle clic en next

16.- Acá vamos a darle un clic en examinar ya que este nos permite entrelazar

nuestro información que tenemos con Access la buscamos y aceptamos

Page 97: Ejercicios de visual

17.- Acá ya escogido nuestro Access damos clic en nueva conexión y ponemos next

y también nos saldrá una ventana la cual tenemos que dar clic en no y listo.

18.- Acá se nos desplegara una nueva ventana la cual tenemos que elegir las dos

opciones y aceptar

Page 98: Ejercicios de visual

19.- Ya creado nuestro reporte tenemos que dirigirnos a origen de datos y taspasar

todo los datos necesarios para crear nuestro ingreso de datos.

20.- Ya traspasado dodos nuestros datos yos podemos configurar como nosotros

queramos incluso ponerle una imagen según sea el tema de nuestro programa

Page 99: Ejercicios de visual

21.-Ya echo todo eso creamos otro formulario donde en este vamos a crear nuestro

crystareportviwer yo escogemos en nuestra barra de herramientas.

22.-ya escogido se nos desplegara una nueva ventana donde tenemos que escoger

nuestro reporte ya creado anterior mente y listo ya podemos verla

23.-Acá vamos a crea una nueva conexión donde tenemos la oportunidad de

agruparlos como nosotros queramos o filtrarlos según lo pedido del programa,

tenemos que dirigirnos al icono proyecto y escoger la opción agregar nuevo

Page 100: Ejercicios de visual

elemento después dirigirnos a reporting y escoger cristal reporty

24.- Acá escogemos la opción estándar damos clic en aceptar

25.- En esta ventana tenemos que escoger nuestro informe que lo tenemos

desarrollado en Access

Page 101: Ejercicios de visual

26.-Ya elegido nuestra base de datos tenemos que buscarla en esta ficha y pasarla a

la otra ventana.

27.-Aca tenemos que pasar todos los datos a la otra plantilla

Page 102: Ejercicios de visual

28.- Acá pasamos lo datos con los que queramos que se agrupen

Page 103: Ejercicios de visual

28.- escogemos el formato estándar y aceptamos

29.- listo ya tenemos nuestro informe

Page 104: Ejercicios de visual

30.-realizamos otro formulario ponemos aca el informe

Page 105: Ejercicios de visual

22.- Al final ejecutamos nuestro programa y podemos ver que nos saldrá la

ventana de la clave La ingresamos y nos dirigirá al menú.

Page 106: Ejercicios de visual

23.-Aca en este menú elegimos ingreso de datos dándole doble clic

24.-Acá ingresamos los datos y guardamos y dándole un clic en detalles podremos

ver lo que hemos guardado.

Page 107: Ejercicios de visual
Page 108: Ejercicios de visual

APLICACIÓN Nº 20

TEMA: 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.

COMPONENTES

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

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.

Page 109: Ejercicios de visual

OBJETOS UTILIZADOS LOGINFORM1

OBJETO CANT. Names

Textbox 2 UsernameLabel

PasswordLabel

Label 2 UsernameTextBox

PasswordTextBox

Buttoms

2 Ok Cancel

Picturebox

1 LogoPictureBox

FORM PARA MENU PRINCIPAL

OBJETO CANT. Names

Form 1 PRINCIPAL ToolStripMenuItem

4 ToolStripMenuItem1 CONSULTASToolStripMenuItem REPORTEToolStripMenuItem SALIRToolStripMenuItem

FORM PARA INGRESO DE DATOS

OBJETO CANT. Names

Form 1 Form1 Panel 1 Panel1 Groupbox

1 GroupBox1

Textbox 6 Ingreso código Nombre Categoría

Cantidad p. unitario p. total

Labels 6 código Nombre Categoría

Cantidad p. unitario p. total

Page 110: Ejercicios de visual

FORM PARA VISUALIZAR REPORTES

OBJETO CANT. Names

Form 1 REPORTE CrystalReportViewer

1 CrystalReportViewer1

FORM PARA VISUALIZAR CONSULTA

OBJETO CANT. Names

Form 1 CONSULTA DataGridView 1 DataGridView

PROGRAMACION

Formulario principal

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

Page 111: Ejercicios de visual

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

Page 112: Ejercicios de visual

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

Page 113: Ejercicios de visual

CAPTURA DE PANTALLAS PROYECTO EN ACCESS

Diseño de Formulario

Pantalla de ingreso de clave

CONCLUSIONES

Hemos hecho uso de importantes herramientas de visual que nos da una

facilidad de manejar los formularios con diseños a nuestro gusto.

Page 114: Ejercicios de visual

CON EL TRABAJO REALIZADO PODEMOS OBSERVAR QUE HEMOS APLICADO TODOS

LOS CONOCIMIENTOS OBTENIDOS EN CLASE MANIPULANDO Y DETALLANDO CADA

ARGUMENTO REALIZADO EN LAS APLICACIONES Y AL FINAL RECONOCIENDO

CADA UNA DE LAS ESTRUCTURAS DE CONTROL QUE EXISTEN.

Page 115: Ejercicios de visual

REALIZADO POR

SABRINA EVELIN CASTRO PEÑALOZA