PROGRAMACION VISUAL I
-
Upload
masaquiza-alexandra -
Category
Documents
-
view
245 -
download
2
description
Transcript of PROGRAMACION VISUAL I
1
UNIVERSIDAD TÉCNICA DE AMBATO
FACULTAD DE CIENCIAS HUMANAS Y DE LA
EDUCACIÓN
CARRERA DE DOCENCIA EN INFORMÁTICA Y
COMPUTACIÓN
NOMBRE:
ALEXANDRA MASAQUIZA
TUTOR:
ING. WILMA GAVILANEZ
TEMA:
CUADERNO DIGITAL DE EJERCICIOS DE
APLICACIONES
SEMESTRE:
QUINTO
MATERIA:
LENGUAJE DE PROGRAMACIÓN I
2
ELEMENTO TRES
EJERCICIOS DE APLICACIÓN
CON VISUAL
PASOS PARA CREAR LA APLICACIÓN EN VISUAL
AL abrir la aplicación de visual tendremos esta pantalla como inicial en la cual
presionamos en crear proyecto de esta manera
CLIC EN CREAR
3
AL momento de haber presionado en CREAR PROYECTO tendremos a
continuación esta ventana en la cual vamos a crear la aplicación e
ingresamos el nombre Y ACEPTAMOS
Tendremos esta pantalla en la cual realizaremos nuestra aplicación
Para guardar la aplicación realizaremos lo siguiente:
INGRESA EL NOMBRE
CLIC EN ARCHIVO
CLIC EN GUARDAR TODO
CLIC EN GUARDAR
COMO
4
APLICACIÓN
CARATULA
DESCRIPCIÓN
En esta aplicación solo mostraremos datos en la cual solo
escribiremos solo datos los mismos para poder visualizarlos de una
manera adecuada
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
5
3. Componentes
LABEL
Cantidad 10
LABEL1
Name Label1
Text UNIVERSIDAD TECNICA DE AMBATO
LABEL2 Name Label2 Text FACULTAD DE CIENCIAS HUMANAS Y DE LA EDUCACION
LABEL3
Name Label3 Text CARRERA
LABEL4
Name Label4 Text DOCENCIA EN INFORMATICA
LABEL5
Name Label5
Text MODULO
LABEL6
Name Label6
Text PROGRAMACION I
LABEL7
Name Label7
Text DOCENTE
LABEL8
Name Label8
Text WILMA GAVILANEZ
LABEL9 Name Label9 Text REALIZADO POR:
6
LABEL10
Name Label10
Text ALEXANDRA MASAQUIZA
PICTUREBOX
Cantidad 2
PICTUREBOX1
Name PICTUREBOX1
IMAGE (A su gusto)
PICTUREBOX1
Name PICTUREBOX2
IMAGE (A su gusto)
7
APLICACIÓN
DATOS PERSONALES DESCRIPCIÓN
En esta aplicación visualizaremos de una manera adecuada dos
form para realizar en ingreso de datos personales en el uno
podremos introducir la clave y acceder al sistema y en el otro
ingresaremos los datos del persona
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
8
3. COMPONENTES
LABEL
Cantidad 5
FORM2
LABEL1
Name Label1
Text Bienvenidos
FORM1
LABEL2 Name Label2 Text Datos personales
LABEL3
Name Label3 Text NOMBRE
LABEL4
Name Label4 Text APELLIDO
LABEL5
Name Label5
Text EDAD
BUTTON
CANTIDAD 5
FORM2
BUTTON1
Name Button1
Text DATOS
BUTTON2
Name Button2
Text SALIR
FORM1
BUTTON1
Name Button1
Text INGRESAR
9
BUTTON2
Name Button2
Text NUEVO
BUTTON3
Name Button3
Text REGRESAR
3.CODIFICADO
BIENVENIDA Public Class Form2 Private Sub cmddatos_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmddatos.Click Form2.Hide() Form1.Show() End Sub Private Sub cmdsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsalir.Click End End Sub End Class DATOS 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 el nombre") TxtNOMBRE.Text = NOMBRE APELLIDO = InputBox("Ingrese el apellido") TxtAPELLIDO.Text = APELLIDO edad = InputBox("Ingrese la edad") TxtEDAD.Text = edad MsgBox("Mis nombres es" & NOMBRE & " " & APELLIDO & " " & edad) End Sub Private Sub CmdNUEVO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdNUEVO.Click TxtAPELLIDO.Text = "" TxtNOMBRE.Text = "" TxtEDAD.Text = ""
10
End Sub 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
APLICACIÓN
CONTROL DE NOTAS
DESCRIPCIÓN
En esta aplicación visualizaremos de una manera adecuada dos
form para realizar en el control de notas en el uno podremos
introducir la clave y acceder al sistema de datos personales. En el
otro ingresaremos los datos correspondientes
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
11
3. COMPONENTES
LABEL
Cantidad 11
FORM1
LABEL1
Name Label1
Text Bienvenidos
LABEL2
Name Label2
Text USUARIO
LABEL3
Name Label3
Text CONTRASEÑA
FORM2
LABEL1
Name Label1
Text CONTROL DE NOTAS
LABEL2
Name Label2
Text MODULO
LABEL3
Name Label3
Text NOMBRE
12
LABEL4
Name Label4
Text DEBERES
LABEL5
Name Label5
Text LECCIONES
LABEL6
Name Label6
Text EXAMENES
LABEL7
Name Label7
Text PROMEDIO
LABEL8
Name Label8
Text EQUIVALENCIA
TEXTBOX
Cantidad 9
FORM1
TEXBOX1
Name Textbox1
Text Para ingresar el nombre del usuario
TEXBOX 2
Name Textbox2
Text Para ingresar la contraseña del usuario
FORM2
TEXBOX 1
Name Textbox1
Text Para ingresar el nombre estudiante
TEXBOX 2
Name Textbox2
Text Para ingresar el modulo
TEXBOX 3
Name Textbox3
Text Para ingresar la nota de deberes
TEXBOX 4
Name Textbox4
Text Para ingresar la nota de lecciones
TEXBOX 5
Name Textbox5
Text Para ingresar la nota de exámenes
TEXBOX 6
Name Textbox5
13
Text Para calcular el promedio
TEXBOX 7
Name Textbox5
Text Para mostrar la equivalencia
4. CODIFICADO
FORM1 INICIAL CLAVE
Private Sub cmdingreso_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdingreso.Click If (txtcontraseña.Text = 12345) Then Me.Hide() Form2.Show() Else MsgBox("CONTRASEÑA INCORRECTA") txtcontraseña.Focus() txtcontraseña.SelectionStart = 0 txtcontraseña.Text = "" End If End Sub
FORM2 INICIAL CLAVE
Public Class Form2
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox3.TextChanged
TextBox6.Text = (((Val(TextBox3.Text)) + (Val(TextBox4.Text)) + (Val(TextBox5.Text))) / 3)
If (Val(TextBox3.Text)) > 1 And (Val(TextBox3.Text)) <= 10 Then Else MsgBox("INGRESE UN VALOR ENTRE 1 Y 10") TextBox3.Text = "" TextBox3.Focus() End If End Sub Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged If (Val(TextBox4.Text)) > 1 And (Val(TextBox4.Text)) <= 10 Then Else MsgBox("INGRESE LOS UN VALOR ENTRE 1 Y 10") TextBox4.Text = "" TextBox4.Focus() End If
14
TextBox6.Text = (((Val(TextBox3.Text)) + (Val(TextBox4.Text)) + (Val(TextBox5.Text))) / 3) End Sub Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged If (Val(TextBox5.Text)) > 1 And (Val(TextBox5.Text)) <= 10 Then Else MsgBox("INGRESE UN VALOR ENTRE 1 Y 10") TextBox5.Text = "" TextBox5.Focus() End If TextBox6.Text = (((Val(TextBox3.Text)) + (Val(TextBox4.Text)) + (Val(TextBox5.Text))) / 3) If (TextBox6.Text >= 7) Then TextBox7.Text = ("APROBADO") ElseIf (TextBox6.Text < 7) And (TextBox6.Text > 5) Then TextBox7.Text = ("SUSPENSO") ElseIf (TextBox6.Text < 4) Then TextBox7.Text = ("REPRUEBA") End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "
15
APLICACIÓN
CONTROL DE NOTAS
DESCRIPCIÓN
En esta aplicación visualizaremos de una manera adecuada 3 form
para realizar el control de notas en el uno podremos ingresar
directamente al siguiente form y también podremos regresar al
inicio de bienvenida para ingresar al siguiente form.
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
16
3. COMPONENTES
LABEL
Cantidad 9
FORM1
LABEL1
Name Label1
Text OPERACIONES CON LAZOS
FORM2
LABEL1
Name Label1
Text TABLAS
LABEL2
Name Label2
Text INGRESE EL FACTOR
LABEL3
Name Label3
Text INGRESE EL LIMITE
FORM3
LABEL1
Name Label1
Text SERIES
LABEL2
Name Label2
Text LIMITE
LABEL3
Name Label3
Text FIBONACI
LABEL4
Name Label4
Text FACTORIAL
LABEL5
Name Label5
Text PRIMOS
17
4. CODIFICADO Public Class Form1 Private Sub cmdtablas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdtablas.Click Form2.Show() Me.Hide() End Sub Private Sub cmdsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsalir.Click End End Sub Private Sub cmdseries_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdseries.Click Form3.Show() Me.Hide() End Sub End Class TABLA Public Class Form2 Private Sub cmdregresar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdregresar.Click Form1.Show() Me.Hide() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim multi As Byt For inicio = 1 To Val(txtlimite.Text) Step 1 multi = Val(txtfactor.Text) * inicio ListBox1.Items.Add(inicio & "*" & Val(txtfactor.Text) & "=" & multi) Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Clic ListBox1.Items.Clear() txtfactor.Clear() txtlimite.Clear() End Sub Private Sub txtfactor_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtfactor.TextChanged End Sub End Class SERIRES Public Class Form3
18
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a, b, c As Byte a = 1 b = 0 For inicio = 1 To Val(txtlimite.Text) Step 1 c = a + b ListBox1.Items.Add(Val(c)) a = b b = c Next End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Form1.Show() Me.Hide() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim x As Byte For inicio2 = 1 To Val(txtlimitepri.Text) Step 1 x = 0 For inicio3 = 1 To Val(txtlimitepri.Text) Step 1 If (inicio2 Mod inicio3 = 0) Then x = x + 1 End If Next If (x = 2) Then ListBox3.Items.Add(Val(inicio2)) End If Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim d As Byte d = 1 For inicio = 1 To Val(txtfactorial.Text) Step 1 d = d * inicio ListBox2.Items.Add(Val(d)) Next End Sub End Class
19
APLICACIÓN
PROFORMA DE VINOS Y LICORES
DESCRIPCIÓN
En esta aplicación visualizaremos de una manera adecuada, en un
form para realizar la proforma y calcula todos sus datos
correspondientes
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
3. COMPONENTES
LABEL
Cantidad 10
FORM1
LABEL1
Name Label1
20
Text PROFORMA VINOS Y LICORES
LABEL2
Name Label2
Text CANTIDAD
LABEL3
Name Label3
Text P.UNITARIO
LABEL4
Name Label4
Text P.TOTAL
LABEL5
Name Label5
Text SELECCIONE SU FORMA DE PAGO
LABEL6
Name Label6
Text +15%
LABEL7
Name Label7
Text -15%
LABEL8
Name Label8
Text IVA
LABEL9
Name Label9
Text TOTAL
LABEL10
Name Label10
Text TOTAL A PAGAR
TEXTBOX
Cantidad 8
TEXTBOX8
Name Textbox1
Text Para ingresar la cantidad
TEXTBOX7
Name Textbox2
Text Para que visualice el precio unitario
TEXTBOX6
Name Textbox3
Text Para que visualice el precio total
TEXTBOX5
Name Textbox4
Text calcula el IVA
21
TEXTBOX4
Name Textbox5
Text Calcula en valor total
TEXTBOX3
Name Textbox6
Text Calcula el valor a pagar
TEXTBOX2
Name Textbox7
Text Calcula menos el descuento
TEXTBOX1
Name Textbox8
Text Calcula mas el descuento
4. CODIFICADO
Public Class Form1 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.75") DATOS1 = txtprecio.Text PictureBox1.Load("C:\POFORMA\WISKY.JPG") ElseIf (DATOS = 1) Then txtprecio.Text = Val("90.45") DATOS1 = txtprecio.Text PictureBox1.Load("C:\POFORMA\VOLCA.JPG") ElseIf (DATOS = 2) Then txtprecio.Text = Val("130") DATOS1 = txtprecio.Text PictureBox1.Load("C:\POFORMA\CHIVAS.JPG") ElseIf (DATOS = 3) Then txtprecio.Text = Val("90.21") DATOS1 = txtprecio.Text PictureBox1.Load("C:\POFORMA\RON.JPG") End If End Sub
22
Private Sub txtcantidad_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcantidad.TextChanged txttotal.Text = Format(Val(txtcantidad.Text) * Val(DATOS1), "##.00") txtiva.Text = Format(Val(txttotal.Text) * 0.12, "##.00") txttotalpa.Text = Format(Val(txttotal.Text) + Val(txtiva.Text), "##.00") End Sub 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 txtcredito.Text = Format(Val(txttotalpa.Text) * 0.15, "##.00") txtpagar.Text = Format(Val(txttotalpa.Text) + Val(txtcredito.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 Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged txtcontado.Text = Format(Val(txttotalpa.Text) * 20 / 100, "##.00") txtpagar.Text = Format(Val(txttotalpa.Text) - Val(txtcontado.Text), "##.00") End Sub Private Sub txtiva_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtiva.TextChanged End Sub End Clas
23
APLICACIÓN
PROFORMA DE LAS PARTES DE LA COMPUTADORA
DESCRIPCIÓN
En esta aplicación visualizaremos de una manera adecuada en tres
form la realización de la proforma en el primer form esta la pantalla
de inicio en el segundo form ingresaremos los datos del cliente y en
el tercer form esta la proforma de las partes del computador y
calcula todos sus datos
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
24
25
3. COMPONENTES
LABEL
Cantidad 20
FORM1
LABEL1
Name Label1
Text BIENVENIDOS
LABEL2
Name Label2
Text USUARIO
LABEL3
Name Label3
Text CONTRASEÑA
FORM2
LABEL1
Name Label1
Text DATOS DEL CLIENTE
LABEL2
Name Label2
Text NOMBRE
LABEL3
Name Label3
Text APELLIDO
LABEL4
Name Label4
Text DIRECCION
LABEL5
Name Label5
Text TELEFONO FORM 3
LABEL1
Name Label1
Text PARTES DEL COMPUTADOR
LABEL2
Name Label2
Text CANTIDAD
LABEL3
Name Label3
Text PRE_UNITARIO
26
LABEL4
Name Label4
Text PRE_TOTAL
LABEL5
Name Label5
Text DISCO DURO
LABEL6
Name Label6
Text MAINBOAR
LABEL7
Name Label7
Text MEMORIA
LABEL8
Name Label8
Text MONIYOR
LABEL9
Name Label9
Text SUB TOTAL
LABEL10
Name Label10
Text IVA
LABEL11
Name Label11
Text TOTAL
LABEL12
Name Label12
Text TOTAL A PAGAR
TEXTBOX
Cantidad 8
TEXTBOX1
Name Textbox1
Text Para ingresar el usuario
TEXTBOX2
Name Textbox2
Text Para ingresar la contraseña FORM 2
TEXTBOX1
Name Textbox1
Text Para ingresar el nombre TEXTBOX2
Name Textbox2
27
Text Para ingresar el apellido
TEXTBOX6
Name Textbox6
Text para ingresar dirección
TEXTBOX3
Name Textbox7
Text para ingresar teléfono
FORM3 TEXTBOX1 Name Textbox1
Text PARA INGRESAR LA CANTIDA(X4)
TEXTBOX2 Name Textbox2
Text PARA LA CANTIDAD DEL PRECIO UNITARIO
TEXTBOX3 Name Textbox3
Text calcula el IVA
TEXTBOX4 Name Textbox4
Text PARA VISUALIZAR LA CANTDAD DEL PRECIO TOTAL
TEXTBOX5 Name Textbox5
Text PARA VISUALIZAR LA CANTDAD DEL SUBTOTAL
TEXTBOX5 Name Textbox5
Text PARA VISUALIZAR LA CANTDAD DEL TOTAL A PAGAR
4. CODIFICADO
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If txtclave.Text = ("ALEXA") Then Form3.Show() Me.Hide() Else MsgBox("CONTRASEÑA INVALIDA") txtclave.Focus() txtclave.SelectionStart = 0 txtclave.Text = "" End If End Sub
28
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtclave.TextChanged End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class INGRESO DE DATOS Public Class Form3 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Form1.Show() Me.Hide() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Form2.Show() Me.Hide() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click txtnombre.Clear() txtapellido.Clear() txtdirec.Clear() txttele.Clear() End Sub End Class INGRESO DE PRECIOS Public Class Form2 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
29
If (DATOS = 0) Then txtunitario.Text = Val("88.75") DATOS1 = txtunitario.Text ElseIf (DATOS = 1) Then txtunitario.Text = Val("58.45") DATOS1 = txtunitario.Text ElseIf (DATOS = 2) Then txtunitario.Text = Val("130") DATOS1 = txtunitario.Text ElseIf (DATOS = 3) Then txtunitario.Text = Val("80.21") DATOS1 = txtunitario.Text End If End Sub Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged If (DATOS = 0) Then txtunitario2.Text = Val("100") DATOS1 = txtunitario2.Text txtunitario2.Text = Val("80.45") DATOS1 = txtunitario2.Text ElseIf (DATOS = 2) Then txtunitario2.Text = Val("110") DATOS1 = txtunitario2.Text ElseIf (DATOS = 3) Then txtunitario2.Text = Val("180.21") DATOS1 = txtunitario2.Text End If End Sub Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged If (DATOS = 0) Then txtunitario3.Text = Val("80.75") DATOS1 = txtunitario3.Text ElseIf (DATOS = 1) Then
30
txtunitario3.Text = Val("50.45") DATOS1 = txtunitario3.Text ElseIf (DATOS = 2) Then txtunitario3.Text = Val("90") DATOS1 = txtunitario3.Text ElseIf (DATOS = 3) Then txtunitario3.Text = Val("50") DATOS1 = txtunitario3.Text End If End Sub Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged If (DATOS = 0) Then txtunitario4.Text = Val("90.75") DATOS1 = txtunitario4.Text ElseIf (DATOS = 1) The txtunitario4.Text = Val("50.45") DATOS1 = txtunitario4.Text ElseIf (DATOS = 2) Then txtunitario4.Text = Val("140") DATOS1 = txtunitario4.Text ElseIf (DATOS = 3) Then txtunitario4.Text = Val("70.21") DATOS1 = txtunitario4.Text End If End Sub Private Sub txtcantidad_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcantidad.TextChanged txttotal.Text = Format(Val(txtcantidad.Text) * Val(DATOS1), "##.00") txtsubto.Text = Format(Val(txttotal.Text) + Val(txttotal2.Text) + Val(txttotal3.Text) + Val(txttotal4.Text), "##.00") txtiva.Text = Format(Val(txtsubto.Text) * 0.12, "##.00") txtpagar.Text = Format(Val(txtsubto.Text) + Val(txtiva.Text), "##.00") End Sub Private Sub txtcantidad2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcantidad2.TextChanged txttotal2.Text = Format(Val(txtcantidad2.Text) * Val(DATOS1), "##.00") txtsubto.Text = Format(Val(txttotal.Text) + Val(txttotal2.Text) + Val(txttotal3.Text) + Val(txttotal4.Text), "##.00")
31
txtiva.Text = Format(Val(txtsubto.Text) * 0.12, "##.00") txtpagar.Text = Format(Val(txtsubto.Text) + Val(txtiva.Text), "##.00") End Sub Private Sub txtcantidad3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcantidad3.TextChanged txttotal3.Text = Format(Val(txtcantidad3.Text) * Val(DATOS1), "##.00") txtsubto.Text = Format(Val(txttotal.Text) + Val(txttotal2.Text) + Val(txttotal3.Text) + Val(txttotal4.Text), "##.00") txtiva.Text = Format(Val(txtsubto.Text) * 0.12, "##.00") txtpagar.Text = Format(Val(txtsubto.Text) + Val(txtiva.Text), "##.00") End Sub Private Sub txtcantidad4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcantidad4.TextChanged txttotal4.Text = Format(Val(txtcantidad4.Text) * Val(DATOS1), "##.00") txtsubto.Text = Format(Val(txttotal.Text) + Val(txttotal2.Text) + Val(txttotal3.Text) + Val(txttotal4.Text), "##.00") txtiva.Text = Format(Val(txtsubto.Text) * 0.12, "##.00") txtpagar.Text = Format(Val(txtsubto.Text) + Val(txtiva.Text), "##.00") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Form1.Show() Me.Hide() End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged txtcredito.Text = Format(Val(txtpagar.Text) * 0.1, "##.00") txtpagartotal.Text = Format(Val(txtpagar.Text) + Val(txtcredito.Text), "##.00") End Sub Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged txtcredito.Text = Format(Val(txtpagar.Text) * 0.1, "##.00") txtpagartotal.Text = Format(Val(txtpagar.Text) - Val(txtcredito.Text), "##.00") End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click txtcantidad.Clear()
32
txtcantidad2.Clear() txtcantidad3.Clear() txtcantidad4.Clear() txtunitario.Clear() txtunitario2.Clear() txtunitario3.Clear() txtunitario4.Clear() txttotal.Clear() txttotal2.Clear() txttotal3.Clear() txttotal4.Clear() txtsubto.Clear() txtiva.Clear() txtpagar.Clear() txtpagartotal.Clear() txtcredito.Clear() txtcontado.Clear() End Sub Private Sub txttotal4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txttotal4.TextChanged End Sub End Class
33
APLICACIÓN
SISTEMA SOLAR
DESCRIPCIÓN
En esta aplicación visualizaremos de una manera adecuada en un
form la realización del sistema solar mostrando la imagen y un
texto adecuando
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
3. COMPONENTES
LABEL
Cantidad 3
FORM1
LABEL1
Name Label1
Text SISTEMA SOLAR
LABEL2
34
Name Label2
Text ESCOJA UN PLANETA
LABEL2
Name Label2
Text DEFINICION
COMBOBOX
Cantidad 1
COMBOBOX
Name combobox
Text para visualizar la definición de los planetas PICTUREBOX
Cantidad 2
PICTUREBOX1
Name PICTUREBOX1
Text para visualizar la imagen seleccionada del planeta PICTUREBOX2
Name PICTUREBOX2
Text para visualizar la imagen seleccionada del planeta
4. CODIFICADO
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.Items.Add("MERCURIO") ComboBox1.Items.Add("VENUS") ComboBox1.Items.Add("TIERRA") ComboBox1.Items.Add("MARTE") ComboBox1.Items.Add("JUPITER") ComboBox1.Items.Add("SATURNO") End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Select Case (ComboBox1.SelectedIndex)
35
Case Is = 0 TextBox1.Text = "Mercurio es el planeta del Sistema Solar más próximo al Sol, y el más pequeño (a excepción de los planetas enanos). Forma parte de los denominados planetas interiores o terrestres. Mercurio no tiene satélites. Se conocía muy poco sobre su superficie hasta que fue enviada la sonda planetaria Mariner 10, y se hicieron observaciones con radares y radiotelescopios" PictureBox1.Load("C:\SISTEMA SOLAR\mercuriop.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. Recibe su nombre en honor a Venus, la diosa romana del amor. Se trata de un planeta de tipo terrestre o telúrico, llamado con frecuencia el planeta hermano de la Tierra, ya que ambos son similares en cuanto a tamaño, masa y composición" PictureBox1.Load("C:\SISTEMA SOLAR\venusp.jpg") PictureBox2.Image = ImageList1.Images(1) Case Is = 2 TextBox1.Text = "La Tierra es el tercer planeta del Sistema Solar, considerando su distancia al Sol, y el quinto de ellos según su tamaño. Es el único planeta del universo que se conoce en el que exista y se origine la vida. La Tierra se formó al mismo tiempo que el Sol y el resto del Sistema Solar, hace 4.570 millones de años." PictureBox1.Load("C:\SISTEMA SOLAR\tierrap.jpg") PictureBox2.Image = ImageList1.Images(2) Case Is = 3 TextBox1.Text = "Marte es el cuarto planeta del Sistema Solar. Forma parte de los llamados planetas telúricos (de naturaleza rocosa, como la Tierra) y es el primero de los planetas exteriores a la órbita terrestre." PictureBox1.Load("C:\SISTEMA SOLAR\martep.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.." PictureBox1.Load("C:\SISTEMA SOLAR\jupiterp.jpg") PictureBox2.Image = ImageList1.Images(4) Case Is = 5 TextBox1.Text = "Saturno es el sexto planeta del Sistema Solar, es el segundo en tamaño después de Júpiter y es el único con un sistema de anillos visible desde nuestro planeta. Su nombre proviene del dios romano Saturno. Forma parte de los denominados planetas exteriores o gaseosos, también llamados jovianos por su parecido a Júpiter. Antes de la invención del telescopio, Saturno era el más lejano de los planetas conocidos y, a simple vista, no parecía luminoso ni interesante." PictureBox1.Load("C:\SISTEMA SOLAR\saturnop.jpg") PictureBox2.Image = ImageList1.Images(5) End Select End Sub End Class
36
APLICACIÓN
SISTEMAS DE MATRICULA
DESCRIPCIÓN
En esta aplicación visualizaremos de una manera adecuada en un
form para realizar el sistema de matrícula utilizaremos una nueva
herramienta SPLITCONTAINER
SPLITCONTAINER
Es un separador en el cual nos ayudara a tener una mejor vista de la aplicación
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
SPLITCONTAINER
37
3. COMPONENTES
LABEL
Cantidad 14
FORM1
LABEL1
Name Label1
Text DATOS PERSONALES
LABEL2
Name Label2
Text NOMBRE
LABEL3
Name Label3
Text APELLIDO
LABEL4
Name Label4
Text CEDULA
LABEL5
Name Label5
Text DIRECCION
LABEL6
Name Label6
Text TELEFONO
LABEL7
Name Label7
Text DATOS PERSONALES
LABEL8
Name Label8
Text TIPOS
LABEL9
Name Label9
Text COLEGIOS
LABEL10
Name Label10
Text MATRICULA
LABEL11
Name Label11
Text SERVICIO MEDICO
LABEL12
Name Label12
Text SERVICIO INTERNET
38
LABEL13
Name Label13
Text SERVICIO DE RECREACION
LABEL14
Name Label14
Text TOTAL A PAGAR
4. CODIFICADO
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load ComboBox1.Items.Add("PARTICULAR") ComboBox1.Items.Add("FISCAL") ComboBox1.Items.Add("FISCOMISIONAL") End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Select (ComboBox1.SelectedIndex) Case Is = 0 ComboBox2.Items.Add("Colegio Gonzales Suarez") ComboBox2.Items.Add("Colegio San Alfonso") ComboBox2.Items.Add("Colegio La Merced") ComboBox2.Items.Add("Colegio La Salle") txtvamatri.Text = Format(Val("250"), "##.00") txtmedico.Text = Format(Val(txtvamatri.Text) * 9 / 100, "##.00") txtinter.Text = Format(Val(txtvamatri.Text) * 10 / 100, "##.00") txtrecrea.Text = Format(Val(txtvamatri.Text) * 12 / 100, "##.00") txttopagar.Text = Format(Val(txtvamatri.Text) + Val(txtmedico.Text) + Val(txtinter.Text) + Val(txtrecrea.Text), "##.00") Case Is = 1 ComboBox2.Items.Add("Colegio Ambato") ComboBox2.Items.Add("Colegio Hispano") ComboBox2.Items.Add("Colegio Bolivar") ComboBox2.Items.Add("Colegio Guayaquil") txtvamatri.Text = Format(Val("120"), "##.00") txtmedico.Text = Format(Val(txtvamatri.Text) * 6 / 100, "##.00") txtinter.Text = Format(Val(txtvamatri.Text) * 8 / 100, "##.00") txtrecrea.Text = Format(Val(txtvamatri.Text) * 10 / 100, "##.00")
39
txttopagar.Text = Format(Val(txtvamatri.Text) + Val(txtmedico.Text) + Val(txtinter.Text) + Val(txtrecrea.Text), "##.00") Case Is = 2 ComboBox2.Items.Add("Colegio Tirso de Molina") ComboBox2.Items.Add("Colegio Bautista") ComboBox2.Items.Add("Colegio ") ComboBox2.Items.Add("Colegio Rimiñahui") txtvamatri.Text = Format(Val("180"), "##.00") txtmedico.Text = Format(Val(txtvamatri.Text) * 8 / 100, "##.00") txtinter.Text = Format(Val(txtvamatri.Text) * 9 / 100, "##.00") txtrecrea.Text = Format(Val(txtvamatri.Text) * 11 / 100, "##.00") txttopagar.Text = Format(Val(txtvamatri.Text) + Val(txtmedico.Text) + Val(txtinter.Text) + Val(txtrecrea.Text), "##.00") End Select End Sub Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ComboBox2.Items.Clear() txtvamatri.Clear() txtmedico.Clear() txtinter.Clear() txtrecrea.Clear() txttopagar.Clear() 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
40
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 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 txtcedula_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtcedula.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
41
Private Sub txttelefono_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txttelefono.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 Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class
APLICACIÓN
CONTROL DE PACIENTES
DESCRIPCIÓN
En esta aplicación visualizaremos de una manera adecuada en un
form para realizar el control de pacientes utilizaremos una nueva
herramienta TABCONTROL
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
TABCONTROL
42
3. COMPONENTES
LABEL
Cantidad 10
FORM1
LABEL1
Name Label1
Text DATOS PERSONALES
LABEL2
Name Label2
43
Text NOMBRE
LABEL3
Name Label3
Text APELLIDO
LABEL4
Name Label4
Text EDAD
LABEL5
Name Label5
Text PESO
LABEL6
Name Label6
Text ESTATURA
LABEL7
Name Label7
Text PREESCRIPCIONES MEDICAS
LABEL8
Name Label8
Text PATALOGIAS
LABEL9
Name Label9
Text PREESCRIPCIONES
LABEL10
Name Label10
Text MEDICAMENTOS
TEXTBOX
Cantidad 7
FORM1
TEXTBOX
Name Textbox1
Text PARA INGRESAR EL NOMBRE
LABEL2
Name Label2
Text PARA INGRESAR EL APELLDIO
LABEL3
Name Label3
Text PARA INDICAR LA EDAD
LABEL4
Name Label4
Text PARA INDICAR LA PESO
LABEL5
44
Name Label5
Text PARA INGRESAR LAS PREESCRIPCIONES
LABEL6
Name Label5
Text PARA INGRESAR EL MEDICAMENTO
LABEL7
Name Label5
Text PESO
COMBOBOX
Cantidad 1
COMBOBOC
Name Textbox1
Text PARA SELECCIONAR UNA PATOLOGIA
4. CODIFICADO
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.Items.Add("ALZHEIMER") ComboBox1.Items.Add("EPILEPSIA") ComboBox1.Items.Add("PARKISON") ComboBox1.Items.Add("DIABETES") End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Select (ComboBox1.SelectedIndex) Case Is = 0 txtprescrip.Text = "Mucha lectura,Ejercicios manuales,Formar rompecabezas " txtmedicamento.Text = "Namenda (memantina)" Case Is = 1 txtprescrip.Text = "Descanso,Evitar Estres , Tomar medicacion diaria " txtmedicamento.Text = "Fenobarbital,Primidone(Mysoline)" Case Is = 2 txtprescrip.Text = "Control medico, Ejercicio fisico " txtmedicamento.Text = "Bromocriptina,LEVODOPA" Case Is = 3 txtprescrip.Text = "Evitar alimentos con exceso de azucar " txtmedicamento.Text = " Sulfonilureas" ENd Select End Sub Private Sub txtnombre_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnombre.KeyPress
45
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 txtedad_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtedad.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 txtpeso_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtpeso.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 txtestatura_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtestatura.KeyPress
46
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 Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.Text = Timer1.Tag ' Timer1.Tag = Mid(Timer1.Tag, 2) + Left.ToString(Timer1.Tag) End Sub Private Sub txtnombre_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtnombre.TextChanged End Sub End Class
APLICACIÓN
PRUEBA
DESCRIPCIÓN
En esta aplicación mostraremos todos nuestros conocimientos
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
47
3. COMPONENTES
LABEL
Cantidad 16
FORM1
LABEL1
Name Label1
Text AUTOMATIZACION
LABEL2
Name Label2
Text DATOS DEL VENDEDOR
LABEL3
Name Label3
Text CODIGO
LABEL4
Name Label4
Text NOMBRES
LABEL5
Name Label5
Text APELLIDOS
48
LABEL6
Name Label6
Text TELEFONO
LABEL7
Name Label7
Text LINEAS DE VEHICULOS
LABEL8
Name Label8
Text PRECIO
LABEL9
Name Label9
Text CARACTERISTICAS
LABEL10
Name Label10
Text COLOR
LABEL11
Name Label10
Text MARCA
LABEL12
Name Label12
Text AIRE ACONDICIONADO
LABEL13
Name Label13
Text VALOR VENTAS
LABEL14
Name Label14
Text COMISION
LABEL15
Name Label15
Text TOTAL DE COMISIONES
LABEL16
Name Label16
Text TOTAL A PAGAR
COMBOBOX
Cantidad 3
COMBOBOX
Name COMBOBOX1
Text SELECIONA EL CODIGO
COMBOBOX
Name COMBOBOX2
49
Text SELECIONA LA LINEA DEL VEHICULO
COMBOBOX
Name COMBOBOX3
Text SELECIONA LA RESPUESTA QUE SEA NECESARIA
TEXTBOX
Cantidad 10
TEXTBOX
Name TEXTBOX1
Text MUESTRA EL PRECIO
TEXTBOX Name TEXTBOX2
Text NOMBRE
TEXTBOX
Name TEXTBOX3
Text APELLIDO
TEXTBOX
Name TEXTBOX4
Text DIRECCION
BUTTON
Cantidad 2
BUTTON
Name BUTTON1
Text SALIR
BUTTON
Name BUTTON2
Text LIMPIAR
4. CODIFICADO
Public Class Form1 Dim DATOS As Integer Dim DATOS1 As Double Private Sub cmdcodigo_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged DATOS = ComboBox2.SelectedIndex If (DATOS = 0) Then txtnombre.Text = "LUIZ RAMIRO " txtapellido.Text = "GONZALES LOPEZ" txttelefono.Text = "032451687"
50
ElseIf (DATOS = 1) Then txtnombre.Text = "MARCO ANTONIO" txtapellido.Text = "SUAREZ ACOSTA" txttelefono.Text = "032456980" ElseIf (DATOS = 2) Then txtnombre.Text = "NELSON PEDRO" txtapellido.Text = "SANCHEZ GAVILANES" txttelefono.Text = "032784152" End If 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 txtprecio.Text = 22000.0 txtcolor.Text = "BLANCA" txtmarca.Text = "TOYOTA" PictureBox1.Load("C:\PRUEBA\CAMIONETA.jpg") If Val(txtprecio.Text) >= 22000 And Val(txtprecio.Text) <= 25000 Then txtvaventa.Text = Val(txtprecio.Text) txtcomision.Text = Val(txtvaventa.Text) * 0.04 End If txttcomi.Text = Val(txtcomision.Text) + Val(txttcomi.Text) txttopaga.Text = Val(txtcomision.Text) + Val(txttopaga.Text) Case Is = 1 txtprecio.Text = 25000.0 txtcolor.Text = "PLOMO" txtmarca.Text = "NISSAN" PictureBox1.Load("C:\PRUEBA\NISSAN.jpg") If Val(txtprecio.Text) >= 22000 And Val(txtprecio.Text) <= 25000 Then txtvaventa.Text = Val(txtprecio.Text) txtcomision.Text = Val(txtvaventa.Text) * 0.04 End If txttcomi.Text = Val(txtcomision.Text) + Val(txttcomi.Text) txttopaga.Text = Val(txtcomision.Text) + Val(txttopaga.Text) Case Is = 2 txtprecio.Text = 35000.0 txtcolor.Text = "BLANCA" txtmarca.Text = "FIAT" PictureBox1.Load("C:\PRUEBA\FURGONES.jpg") If Val(txtprecio.Text) > 25000 And Val(txtprecio.Text) <= 35000 Then txtvaventa.Text = Val(txtprecio.Text)
51
txtcomision.Text = Val(txtvaventa.Text) * 0.05 End If txttcomi.Text = Val(txtcomision.Text) + Val(txttcomi.Text) txttopaga.Text = Val(txtcomision.Text) + Val(txttopaga.Text) End Select 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 txtcomision.Text = "" txtvaventa.Text = "" txttcomi.Text = "" End Sub End Class
52
APLICACIÓN
ROL DESCRIPCIÓN Con este proyecto lograremos obtener la automatización de pago para cada empleado
en el primer form estará la bienvenida con su respectiva clase en la segunda estará los
datos que a calcular y calculados
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
53
3. COMPONENTES
FORM
CANTIDAD 2
FORM1 PARA EL ROL DE PAGOS
FORM2 PARA INGRESAR LA CLAVE DEL USUARIO
PICTUREBOX
CANTIDAD 1
PICTUREBOX1 = PARA PONER UNA IMAGEN EN EL FORM2 PARA LA CLAVE
LABEL
CANTIDAD 28
CADA LABEL SE UTILIZO PARA PONER DIFERENTES TITULOS Y SUBTITULOS EN LOS DOS
FORMULARIOS
TEXTBOX
CANTIDAD 18
TEXTBOX1=PARA INGRESAR EL NOMBRE DEL USUARIO
TEXTBOX2= PARA INGRESAR LA OCNTRASEÑA DEL USUARIO
TEXTBOX3= PARA INGRESAR LA CEDULA DEL EMPLEADO
TEXTBOX4= PARA INGRESAR EL NOMBRE DEL CARGO
TEXTBOX5= PARA INGRESAR EL TELEFONO
TEXTBOX6= PARA INGRESAR EL SUELDO
TEXTBOX7= PARA INGRESAR LA DIRECCION
TEXTBOX8= PARA INGRESAR EL IESS
TEXTBOX9= PARA INGRESAR LAS MULTAS
TEXTBOX10= PARA INGRESAR EL TELEFONO
TEXTBOX11=PARA CALCULAR EL DESCUENTO DE LAS MULTAS
54
TEXTBOX12=PARA INGRESAR EL NUMERO DE LAS HORAS EXTRAS
TEXTBOX13=PARA CALCULAR EL TOTAL DE LAS HORAS EXTRAS
TEXTBOX14=PARA INGRESAR EL NUMERO DE CARGO FAMILIAR
TEXTBOX15=PARA CALCULAR EL TOTAL DE EL CARGO FAMILIAR
TEXTBOX16=PARA CALCULAR EL TOTAL DE INGRESOS
TEXTBOX17=EL TOTAL DE EGRESOS
T TEXTBOX18=OTAL 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 EJECUCION
CHEKBOX
CANTIDAD 1
CHEKBOX 1 = PARA SELECCIONAR SI TIENE PRESTAMO O NO
55
4. CODIFICADO
CODIFICADO PARA LA 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
56
ElseIf (DATOS = 5) Then txtcedula.Text = Val("1087451045") txtcargo.Text = "VENDEDOR" txtsueldo.Text = Val("150") DATOS1 = txtsueldo.Text End If End Sub Private Sub txtdirec_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtdirec.KeyPress If Char.IsLetter(e.KeyChar) Then e.Handled = False ElseIf Char.IsControl(e.KeyChar) Then e.Handled = False ElseIf Char.IsSeparator(e.KeyChar) Then e.Handled = False Else e.Handled = True End If End Sub Private Sub txttele_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txttele.KeyPress If Char.IsDigit(e.KeyChar) Then e.Handled = False ElseIf Char.IsControl(e.KeyChar) Then e.Handled = False Else e.Handled = True End If End Sub Private Sub txtextras_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtextras.KeyPress If Char.IsDigit(e.KeyChar) Then e.Handled = False ElseIf Char.IsControl(e.KeyChar) Then e.Handled = False Else e.Handled = True End If End Sub Private Sub txttofami_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txttofami.TextChanged End Sub Private Sub txtextras_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtextras.TextChanged If Val(txtextras.Text) >= 1 And Val(txtextras.Text) <= 10 Then aux = Val(txtsueldo.Text) * 6 / 100 txthextras.Text = Val(txtextras.Text) * aux Else
57
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") 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)
58
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Form2.Show() Me.Hide() End Sub Private Sub txtegresos_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtegresos.TextChanged End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click txtegresos.Text = Format(Val(txtiees.Text) + Val(txttomultas.Text) + Val(txtvalpresta.Text), "###.00") End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click txtingres.Text = Format(Val(txtsueldo.Text) + Val(txthextras.Text) + Val(txttofami.Text), "##.00") End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click txtdirec.Text = "" txttele.Text = "" txtingres.Text = "" txtegresos.Text = "" txtiees.Text = "" txtmonto.Text = "" txtprestamos.Text = "" txtmultas.Text = "" txttomultas.Text = "" txtcargo.Text = "" txttofami.Text = "" txtsueldo.Text = "" txtcargo.Text = "" txtfami.Text = "" txtextras.Text = "" txttorecibe.Text = "" txtsueldo.Text = "" txthextras.Text = "" txtvalpresta.Text = "" txttorecibe.Text = "" End Sub End Class
59
APLICACIÓN
GUIA TELEFONICA
DESCRIPCIÓN
En esta aplicación visualizaremos de una manera adecuada en un
form el LOGINFORM1 en el siguiente esta creado ya el menú en el
cual podemos realizar ingresos de datos y salidas de datos con sus
respectivos reportes
1. Abrir un nuevo Proyecto en Visual Basic
2. Apariencia del Formulario
60
61
3. COMPONENTES
LOGINFORM1 PARA LA CLAVE
FORM1 PARA INGRESAR LOS DATOS DE ENTRADA
FORM1 PARA REALIZAR LAS CONSULTAS
FORM1 PARA VERIFICAR EL REPORTE
BASE DE DATOS EN ACCESS
LABEL
CANTIDAD 1
CADA LABEL SE UTILIZO PARA PONER DIFERENTES TITULOS Y SUBTITULOS EN LOS EL FORMULARIO
62
3. CODIFICADO
If PasswordTextBox.Text = "12345" Then MsgBox("BIENVENIDOS") Me.Hide() Form1.Show() Else MsgBox("CLAVE INCORRECTA") UsernameTextBox.Text = "" PasswordTextBox.Text = "" End If
Public Class Form1 Private Sub INGRESOSToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INGRESOSToolStripMenuItem.Click Dim MDIFORM As New ENTRADA MDIFORM.MdiParent = Me MDIFORM.Show() End Sub Private Sub CONSULTASToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CONSULTASToolStripMenuItem.Click Dim MDIFORM As New CONSULTAS MDIFORM.MdiParent = Me MDIFORM.Show() End Sub Private Sub SALIRToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SALIRToolStripMenuItem.Click End End Sub Private Sub GUIAToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GUIAToolStripMenuItem.Click Dim MDIFORM As New REPORTE MDIFORM.MdiParent = Me MDIFORM.Show() End Sub