Ejercicios Resueltos en Visual Basic 2010
Short Description
Descripción: Ejercicios descargado del Señor Royer...
Description
INSTITUTO DE EDUCACIÓN SUPERIOR PEDAGÓGICO PÚBLICO DE “HUARI”
Lic. Nilthon P Menacho Gonzales
EJERCICIOS PROPUESTOS EN VISUAL BASIC 2012
TRABAJO DOMICILIARIO
ESPECIALIDAD: Computación E Informática VI
ÁREA: Lenguaje de programación
DOCENTE: Lic. Nilthon P. Menacho Gonzales
HUARI - ANCASH - PERÚ
2016
PROYECTOS RESUELTOS EN VISUAL BASIC.NET
Public Class Form1 Dim r, p, i, n As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = "" TextBox1.Focus() Button1.Enabled = False Button2.Enabled = True End Sub LIC. NILTHON MENACHO GONZALES
Página 1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ListBox1.Items.Add(TextBox1.Text) r = Val(TextBox1.Text) Mod 2 If r = 0 Then p = p + 1 Else i = i + 1 End If TextBox2.Text = p TextBox3.Text = i TextBox4.Text = p + i TextBox1.Text = "" Button2.Enabled = False Button1.Enabled = True Button3.Enabled = True Button4.Enabled = True End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click n = ListBox1.SelectedIndex If n = -1 Then MsgBox("no existe elemento seleccionado") Else r = Val(ListBox1.Text) Mod 2 If r = 0 Then p = p – 1 Else i = i – 1 LIC. NILTHON MENACHO GONZALES
Página 2
End If ListBox1.Items.RemoveAt(n) TextBox2.Text = p TextBox3.Text = i TextBox4.Text = p + 1 End If If ListBox1.Items.Count = 0 Then Button3.Enabled = False End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click n = ListBox1.SelectedIndex If n = -1 Then MsgBox("no existe elemento seleccionado") Else r = Val(ListBox1.Text) Mod 2 If r = 0 Then p = p – 1 Else i = i – 1 End If TextBox1.Text = ListBox1.SelectedItem ListBox1.Items.RemoveAt(n) TextBox2.Text = p TextBox3.Text = i TextBox4.Text = p + 1 End If If ListBox1.Items.Count = 0 Then LIC. NILTHON MENACHO GONZALES
Página 3
Button3.Enabled = False End If End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged If Len(TextBox1.Text) = 0 Then Button2.Enabled = False Else Button2.Enabled = True End If End Sub Private Sub Form1_Activated(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Activated TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" Button1.Enabled = True Button2.Enabled = False Button3.Enabled = False Button4.Enabled = False Button1.Enabled = True End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click r = MsgBox("desea cerra la ventana", MsgBoxStyle.YesNo, "cerrar") If r = 6 Then End End If End Sub LIC. NILTHON MENACHO GONZALES
Página 4
EJERCICIO QUE ME PERMITE EL INGRESO DE INCHAS POR MEDIO DE LOS BOTONES Y CUENTA LOS EL TOTAL TANTO DE UNIVERSITARIO Y ALIANZA
ublic Class Form1 Dim n, m, a, b As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'boton permite agragar un hincha de universitario ListBox1.Items.Add(TextBox1.Text) TextBox1.Text = "" Button1.Enabled = False Button2.Enabled = False Button3.Enabled = True 'actualiza los contadores de hinchas TextBox2.Text = ListBox1.Items.Count TextBox3.Text = ListBox2.Items.Count LIC. NILTHON MENACHO GONZALES
Página 5
TextBox4.Text = ListBox1.Items.Count + ListBox2.Items.Count
End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ListBox2.Items.Add(TextBox1.Text) TextBox1.Text = "" Button1.Enabled = False Button2.Enabled = False Button3.Enabled = True 'actualiza los contadores de hinchas TextBox2.Text = ListBox1.Items.Count TextBox3.Text = ListBox2.Items.Count TextBox4.Text = ListBox1.Items.Count + ListBox2.Items.Count End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 'permite escribir el nombre del nuevo hincha TextBox1.Text = "" TextBox1.Focus() Button3.Enabled = False End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged If Len(TextBox1.Text) = 0 Then Button1.Enabled = False Button2.Enabled = False Else Button1.Enabled = True LIC. NILTHON MENACHO GONZALES
Página 6
Button2.Enabled = True End If End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged n = ListBox1.Items.Count m = ListBox2.Items.Count If n + m = 0 Then Button4.Enabled = False Button5.Enabled = False Else Button4.Enabled = True Button5.Enabled = True End If End Sub Private Sub Form1_Activated(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Activated Button1.Enabled = False Button2.Enabled = False Button3.Enabled = True Button4.Enabled = False Button5.Enabled = False End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load End Sub Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged n = ListBox1.Items.Count m = ListBox2.Items.Count LIC. NILTHON MENACHO GONZALES
Página 7
If n + m = 0 Then Button4.Enabled = False Button5.Enabled = False Else Button4.Enabled = True Button5.Enabled = True End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click 'permite borrar hincha n = ListBox1.Items.Count m = ListBox2.Items.Count a = ListBox1.SelectedIndex b = ListBox2.SelectedIndex 'verificar y eliminar cual es la lista seleccionada para eliminar un hincha If a = -1 Then If b = -1 Then MsgBox("no se selecciono elemento a eliminar") Else ListBox2.Items.RemoveAt(b) MsgBox("hincha de alianza eliminado") End If Else ListBox1.Items.RemoveAt(a) MsgBox("hincha de universitario eliminado") End If
LIC. NILTHON MENACHO GONZALES
Página 8
'actualiza contadores TextBox2.Text = ListBox1.Items.Count TextBox3.Text = ListBox2.Items.Count TextBox4.Text = ListBox1.Items.Count + ListBox2.Items.Count If n + m = 0 Then Button4.Enabled = False Button5.Enabled = False Else Button4.Enabled = True Button5.Enabled = True End If End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click 'permite editar hincha n = ListBox1.Items.Count m = ListBox2.Items.Count a = ListBox1.SelectedIndex b = ListBox2.SelectedIndex 'verificar cual es lalista seleccionada para editar un hincha If a = -1 Then If b = -1 Then MsgBox("no se seleciono elemento a editar") Else TextBox1.Text = ListBox2.Items.Count ListBox2.Items.RemoveAt(b) TextBox1.Focus() End If LIC. NILTHON MENACHO GONZALES
Página 9
Else TextBox1.Text = ListBox1.Text ListBox1.Items.RemoveAt(a) TextBox1.Focus() End If 'actualiza contadores TextBox2.Text = ListBox1.Items.Count TextBox3.Text = ListBox2.Items.Count TextBox4.Text = ListBox1.Items.Count + ListBox2.Items.Count If n + m = 0 Then Button4.Enabled = False Button5.Enabled = False Else Button4.Enabled = True Button5.Enabled = True End If End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 10
PERMITE EL INGRESO DE NOMBRE SUELDO CATEGORIA Y PERMITE CALCULAR EL DESCUNETO
Public Class Form1 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ‘BOTON CALACULAR If Val(TextBox2.Text) Then TextBox3.Text = 0.12 * Val(TextBox2.Text) Else If Val(TextBox2.Text) Then TextBox3.Text = 0.09 * Val(TextBox2.Text) Else TextBox3.Text = 0.08 * Val(TextBox2.Text) End If End If TextBox4.Text = Val(TextBox2.Text) + Val(TextBox3.Text) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click LIC. NILTHON MENACHO GONZALES
Página 11
‘BOTON NUEVO TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox1.Focus() End Sub PrivateSub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ‘BOTON SALIR End End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 12
PERMITE INGRESAR EL CANTIDAD, PRODUCTO, PRECIO Y CALCULA EL TOTAL, EL IGV (18%) Y EL TOTAL A PAGAR
Public Class Form1 Dim tot, r, n As Integer Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click GroupBox1.Enabled = True GroupBox2.Enabled = True GroupBox3.Enabled = True TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" LIC. NILTHON MENACHO GONZALES
Página 13
TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" TextBox8.Text = "" TextBox9.Text = "" TextBox10.Text = "" TextBox11.Text = "" RadioButton1.Checked = False RadioButton2.Checked = False ListBox1.Items.Clear() ListBox2.Items.Clear() ListBox3.Items.Clear() ListBox4.Items.Clear() TextBox1.Focus() Button4.Enabled = False End Sub
Private Sub RadioButton1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles RadioButton1.Click If RadioButton1.Checked = TrueThen TextBox2.Visible = True End If End Sub Private Sub RadioButton2_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles RadioButton2.Click If RadioButton2.Checked = TrueThen TextBox2.Visible = False End If LIC. NILTHON MENACHO GONZALES
Página 14
End Sub Private Sub Form1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Click GroupBox1.Enabled = False GroupBox2.Enabled = False GroupBox3.Enabled = False Button1.Enabled = False Button2.Enabled = True Button3.Enabled = False Button4.Enabled = True Button5.Enabled = False Button6.Enabled = True End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'nuevo producto TextBox6.Focus() TextBox6.Text = "" TextBox7.Text = "" TextBox8.Text = "" End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'agregar producto ListBox1.Items.Add(TextBox6.Text) ListBox2.Items.Add(TextBox7.Text) ListBox3.Items.Add(TextBox8.Text) r = Val(TextBox6.Text) * Val(TextBox8.Text) ListBox4.Items.Add(r) tot = tot + r LIC. NILTHON MENACHO GONZALES
Página 15
TextBox9.Text = r TextBox10.Text = 0.18 * r TextBox11.Text = 1.18 * r End Sub Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged If Len(TextBox8.Text) = 0 Then Button1.Enabled = False Else Button1.Enabled = True End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 'borrar producto n = ListBox1.SelectedIndex If n = -1 Then MsgBox("seleccione elemento de la lista 1") Else r = Val(ListBox1.SelectedItem) * Val(ListBox3.Items(n)) ListBox1.Items.RemoveAt(n) ListBox2.Items.RemoveAt(n) ListBox3.Items.RemoveAt(n) ListBox4.Items.RemoveAt(n) tot = tot – r TextBox9.Text = tot TextBox10.Text = 0.18 * tot TextBox11.Text = 1.18 * tot LIC. NILTHON MENACHO GONZALES
Página 16
End If End Sub End Class
PERMITE INGRESAR UN NUMERO Y CALCULA EL AREA DE UN CUADRADO
LIC. NILTHON MENACHO GONZALES
Página 17
Public Class Form4 Dim l, area, r As Integer Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ‘BOTON CALCULAR l = (TextBox1.Text) area = l * l TextBox2.Text = area End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ‘BOTON NUEVO TextBox1.Text = "" TextBox2.Text = "" TextBox1.Focus() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ‘BOTON SALIR r = MsgBox("desea cerrar la ventana", MsgBoxStyle.YesNo, "cerrar") If r = 6 Then End End If End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 18
PERMITE INGRESAR LA CANTIDAD DE UN MONTO DE DINERO, Y CALCULAR O DA HA SABER CUANTO DE BILLETES DE HA DE TENER SEGÚN LA CANTIDAD INGRESADA: BILLETES DE (50, 100,200) Y MUESTRA UN MENSAJE SI DESEA RETIRAR SU TRANSACCION (DINERO)
Public Class Form1 Dim r, m, b200, b100, b50 As Single Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click 'boton ok m = Label2.Text 'verificar si el monto es divisible por 50 r = m Mod 50
LIC. NILTHON MENACHO GONZALES
Página 19
'r=0 es divisible en caso contrario no lo es If r = 0 Then 'numero de billetes de 200 b200 = m / 200 m = m Mod 200 'numero de billetes de 100 b100 = m / 100 m = m Mod 100 'numero de billetes de 50 b50 = m / 50 m = m Mod 50 'mostrar en la caja de texto de billetes de 200 TextBox1.Text = b200 'mostrar en la caja de texto de billetes de 100 TextBox2.Text = b100 'mostrar en la caja de texto de billetes de 50 TextBox3.Text = b50 MsgBox("retire su dinero por favor") Else MsgBox("monto ingresado no es correcto") Button12.Focus() End If End Sub Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click MsgBox("la transeccio ha terminado") End End Sub
LIC. NILTHON MENACHO GONZALES
Página 20
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click Label2.Text = "" End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label2.Text = Label2.Text + "1" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Label2.Text = Label2.Text + "2" End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Label2.Text = Label2.Text + "3" End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Label2.Text = Label2.Text + "4" End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Label2.Text = Label2.Text + "5" End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Label2.Text = Label2.Text + "6" End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click Label2.Text = Label2.Text + "7" End Sub LIC. NILTHON MENACHO GONZALES
Página 21
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click Label2.Text = Label2.Text + "8" End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click Label2.Text = Label2.Text + "9" End Sub Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click Label2.Text = Label2.Text + "0" End Sub End Class
PERMITE EL INGRESO DE DOS NUMEROS Y CALCULA SGUN EL CHECBOX QUE HAY (SUMA, RESTA, MULTIPLICACION Y DIVISION)
Public Class Form1 Dim n, r As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click LIC. NILTHON MENACHO GONZALES
Página 22
‘BOTON NUEVO TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox1.Focus() End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged n = ComboBox1.SelectedIndex Select Case n Case 0 : TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text) Case 1 : TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text) Case 2 : TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text) Case 3 : TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text) End Select End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load ComboBox1.Items.Add("suma") ComboBox1.Items.Add("resta") ComboBox1.Items.Add("producto") ComboBox1.Items.Add("division") End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ‘BOTON CERRAR r = MsgBox("desea cerrar esta ventana", MsgBoxStyle.YesNo, "cerrar") If r = 6 Then End End If LIC. NILTHON MENACHO GONZALES
Página 23
End Sub End Class
PERMITE CALCULAR LA HORA HACIENDO CLICK EN EL BOTTON HORA A Y OJO SOLO SE MUESTRA CON EL RELOJ DEL COMPUTADOR
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ‘BOTON HORA Dim hora = Hour(Now) Dim min = Minute(Now) Dim seg = Second(Now) TextBox1.Text = hora TextBox2.Text = min TextBox3.Text = seg End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 24
PERMITE INGRESAR TU Nº DE CELULAR Y LUEGO ESCRIBIR TU MSM AL Nº DE DESTINO Y TE MOSTRARA UN MENSAJE DE (“SU MSM HA SIDO ENVIADO SATISFACTORIAMENTE”) OJO SOLO PERMITE 140 CARACTERES
Public Class Form1 Dim n, m As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = TextBox1.Text + "1" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = TextBox1.Text + "2" End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged m = Len(TextBox1.Text) LIC. NILTHON MENACHO GONZALES
Página 25
If m = 9 Then TextBox2.Enabled = True 'button12.enabled=true Button13.Enabled = True TextBox2.Focus() End If End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged n = Len(TextBox2.Text) TextBox3.Text = n If n > 0 Then Button12.Enabled = True Else Button12.Enabled = False End If If n >= 140 Then MsgBox("max de caracteres 140, si sigues escribiendo se borran todo") If n = 141 Then TextBox2.Text = "" End If End If End Sub Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click ‘BOTON ENVIAR MsgBox("su mensaje ha sido enviado satisfactoriamente") TextBox1.Text = "" LIC. NILTHON MENACHO GONZALES
Página 26
TextBox2.Text = "" TextBox3.Text = "" End Sub Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click ‘BOTON SALIR End End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Text = TextBox1.Text + "3" End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click TextBox1.Text = TextBox1.Text + "4" End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click TextBox1.Text = TextBox1.Text + "5" End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click TextBox1.Text = TextBox1.Text + "6" End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox1.Text = TextBox1.Text + "7" End Sub Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click TextBox1.Text = TextBox1.Text + "8" EndSub LIC. NILTHON MENACHO GONZALES
Página 27
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click TextBox1.Text = TextBox1.Text + "9" End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click If Len(TextBox1.Text) = 0 Or _ Val(TextBox1.Text) >= 1 Then TextBox1.Text = TextBox1.Text &"0" End If End Sub Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click TextBox2.Text = "" End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 28
PERMITE MOSTRAR MENSAJE SI ACTIVAS EL RADIOBUTTON MASCULINO TE MUESTRA UN MSM (“MASCULINO”) Y SI ACTIVAS EL RADIO BUTTON FEMENINO TE MUESTRA UN MSM (“FEMENINO)
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If RadioButton1.Checked = TrueThen MsgBox("sexo Masculino") End If If RadioButton2.Checked = TrueThen MsgBox("sexo Femenino") End If End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 29
PERMITE CALCULAR EL =AFP, FONAVI ES SALUD TANTO SI ES DE LOS SIGUIENTE DESCUENTOS (“NOMBRADO, CONTRATADO Y PRACTICANTE”) EGUN ESTA CARACTERISTICAS QUE TENEMOS =MOVILIDAD, TOTAL INGRESO, TOTAL DESCUENTO, SUELDO A PAGAR
Public Class Form1 Dim afp, fon, ess, solid, cuarta As Single Private Sub RadioButton1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles RadioButton1.Click CheckBox1.Checked = True CheckBox2.Checked = True CheckBox3.Checked = True CheckBox4.Checked = False CheckBox5.Checked = False LIC. NILTHON MENACHO GONZALES
Página 30
afp = 0.114 * TextBox3.Text fon = 0.05 * TextBox3.Text ess = 0.06 * TextBox3.Text TextBox4.Text = afp TextBox5.Text = fon TextBox6.Text = ess TextBox9.Text = 80 End Sub Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged CheckBox1.Checked = True CheckBox2.Checked = True CheckBox3.Checked = False CheckBox4.Checked = False CheckBox5.Checked = False afp = 0.114 * TextBox3.Text fon = 0.05 * TextBox3.Text ess = 0.06 * TextBox3.Text TextBox4.Text = afp TextBox5.Text = fon TextBox6.Text = ess TextBox10.Text = 100 End Sub Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged CheckBox1.Checked = True CheckBox2.Checked = False CheckBox3.Checked = False LIC. NILTHON MENACHO GONZALES
Página 31
CheckBox4.Checked = False CheckBox5.Checked = False afp = 0.114 * TextBox3.Text fon = 0.05 * TextBox3.Text ess = 0.06 * TextBox3.Text TextBox4.Text = afp TextBox5.Text = fon TextBox6.Text = ess TextBox11.Text = 160 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ‘BOTON NUEVO TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" TextBox8.Text = "" TextBox9.Text = "" RadioButton1.Checked = False TextBox1.Focus() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class LIC. NILTHON MENACHO GONZALES
Página 32
PERMITE INGRESAR LA HORA TRABAJADA, PAGO POR HORA Y EL SUELDO Y TIENE LAS SIGUIENTE BONIFICACIONES (“UN HIJO=5%),(“DOS HIJOS=10%”),(“TRES HIJOS=15%”),(“CUATRO O MAS HIJOS=20%”) TAMBIEN TIENE ESTADO CIVIL QUE PERMITE CALCULAR SI ES SOLTERO O CASADO SEGÚN LOS MONTOS DE LOS ANTERIORES Y TAMBIEN TIENE LOS SIGUIENTES DESCUENTOS (“AFP=7%”),(“CUARTA CATEGORIA=8%”) Y POR ULTIMO MUESTRA EL NETO A PAGAR SEGÚN LAS OPCIONES (BONIFICACIONES, ESTADO CIVIL Y DESCUENTOS”
Public Class Form1 Dim t1, t2 As Integer Private Sub TextBox2_KeyPress(ByVal sender AsObject, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then t1 = TextBox1.Text t2 = TextBox2.Text LIC. NILTHON MENACHO GONZALES
Página 33
TextBox3.Text = t1 * t2 TextBox4.Text = t2 * t1 End If End Sub Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged If RadioButton1.Checked = TrueThen TextBox4.Text = Val(TextBox3.Text) + Val(TextBox3.Text) * 0.05 Else RadioButton1.Checked = False End If End Sub Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged If RadioButton2.Checked = TrueThen TextBox4.Text = Val(TextBox3.Text) + Val(TextBox3.Text) * 0.1 Else RadioButton2.Checked = False End If End Sub Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged If RadioButton3.Checked = TrueThen TextBox4.Text = Val(TextBox3.Text) + Val(TextBox3.Text) * 0.15 Else RadioButton3.Checked = False LIC. NILTHON MENACHO GONZALES
Página 34
End If End Sub Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged If RadioButton4.Checked = TrueThen TextBox4.Text = Val(TextBox3.Text) + Val(TextBox3.Text) * 0.2 Else RadioButton4.Checked = False End If End Sub Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged If RadioButton6.Checked = TrueThen TextBox4.Text = Val(TextBox3.Text) + Val(TextBox3.Text) * 0.03 Else RadioButton6.Checked = False End If End Sub Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged If RadioButton5.Checked = TrueThen TextBox4.Text = 0 Else TextBox4.Text = Val(TextBox3.Text) RadioButton2.Checked = False End If End Sub LIC. NILTHON MENACHO GONZALES
Página 35
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged If CheckBox1.Checked = TrueThen TextBox4.Text = Val(TextBox4.Text) Val(TextBox4.Text) * 0.07 Else CheckBox1.Enabled = False End If End Sub Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked = TrueThen TextBox4.Text = Val(TextBox3.Text) Val(GroupBox1.CanFocus) - Val(RadioButton6.Checked) Else CheckBox1.Enabled = False End If End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 36
INGRESA EL PRODUCTO, PRECIO, CANTIDAD, MONTOY CALCULA EL DESCUENTO (10%) DEL MONTO Y CALCULA EL TOTAL A PAGAR
Public Class Form1
Dim pre, can, monto, descto, pago, r As Single Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ‘BOTON NUEVO TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox1.Focus() End Sub LIC. NILTHON MENACHO GONZALES
Página 37
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ‘BOTON CALCULAR pre = (TextBox2.Text) can = (TextBox3.Text) monto = pre * can If CheckBox1.Checked = TrueThen descto = 0.1 * monto Else descto = 0 End If pago = monto – descto TextBox4.Text = monto TextBox5.Text = descto TextBox6.Text = pago End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ‘BOTON SALIR r = MsgBox("desea cerrar la ventana", MsgBoxStyle.YesNo, "cerrar") If r = 6 Then End End If End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 38
PERMITE EL INGRESO DE SU NOMBRE Y EDAD Y TE MUESTRA UN MENSAJE DE(“MAYOR”) Y (“MENOR”) SEGÚN TU EDAD
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ‘BOTON NUEVO TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox1.Focus() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ‘BOTON ACEPTAR If Val(TextBox2.Text) >= 18 Then TextBox3.Text = "mayor de edad" Else TextBox3.Text = "menor de edad" End If End Sub
LIC. NILTHON MENACHO GONZALES
Página 39
PERMITE CONTAR DATOS CUANDO SE INGRESA Y TIENE LAS OBSIONES (“AÑADIR, BORRAR, NUEVO, EDITAR Y INDEX”)
Public Class Form1 Dim n As Integer Private Sub ListBox1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles ListBox1.Click TextBox1.Text = ListBox1.SelectedIndex End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = ListBox1.SelectedIndex End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ListBox1.Items.Add(TextBox2.Text) LIC. NILTHON MENACHO GONZALES
Página 40
TextBox2.Text = "" TextBox3.Text = ListBox1.Items.Count End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ‘boton borrar n = ListBox1.SelectedIndex If n = -1 Then MsgBox("no hay elemento seleccionado") Else ListBox1.Items.RemoveAt(n) TextBox3.Text = ListBox1.Items.Count End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox2.Focus() End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged If Len(TextBox2.Text) = 0 Then Button2.Enabled = False Else Button2.Enabled = True
End If End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click n = ListBox1.SelectedIndex If n = -1 Then LIC. NILTHON MENACHO GONZALES
Página 41
MsgBox("no ha seleccionado elemento") Else TextBox1.Text = ListBox1.Text ListBox1.Items.RemoveAt(n) TextBox2.Focus() End If End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 42
PERMITE EL INGRESO DEL NOMBRE Y APELLIDO Y SELECCIONAR EL NIVEL DEL COMBO, Y PERMITE AGREGAR AL LISTBOX. SEGÚN TU NIVELQUE ES (“A”, “B”, “C”) LA CANTIDAD DE SOCIOS EMPIEZA A CONTAR ES DECIR ESO SE DA EN LA CATEGORIA DE LA ESTADISTICA DE SOCIOS Y TIENE LAS OBSIONES (“NUEVO, AGREGAR, ELEMINAR, EDITAR, ELIMINAR TODO, CERRAR”)
Dim n, m, a, b, c, r As Single Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'boton permite agregar un nuevo socio ListBox2.Items.Add(TextBox1.Text) TextBox1.Text = "" Button1.Enabled = True Button2.Enabled = True Button4.Enabled = False
LIC. NILTHON MENACHO GONZALES
Página 43
'actualiza la cantidad de socios TextBox2.Text = ListBox2.Items.Count TextBox3.Text = ListBox3.Items.Count TextBox5.Text = ListBox2.Items.Count + ListBox3.Items.Count End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'agregar socio ListBox2.Items.Add(TextBox1.Text) ListBox3.Items.Add(TextBox1.Text) r = (TextBox2.Text) + (TextBox3.Text) + (TextBox4.Text) TextBox5.Text = r End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 'permite eliminar socio n = ListBox2.Items.Count m = ListBox3.Items.Count a = ListBox2.SelectedIndex b = ListBox3.SelectedIndex 'verifica y elimina cual es la lista seleccionada para eliminar un socio If a = -1 Then MsgBox("no se selecciono elemento a eliminar") Else ListBox3.Items.RemoveAt(b) MsgBox("socio eliminado") End If ListBox2.Items.RemoveAt(a) LIC. NILTHON MENACHO GONZALES
Página 44
MsgBox("socio eliminado") 'actualiza contadores TextBox2.Text = ListBox2.Items.Count TextBox3.Text = ListBox3.Items.Count TextBox4.Text = ListBox2.Items.Count If n + m = 0 Then Button1.Enabled = False Button3.Enabled = False Else Button1.Enabled = True Button3.Enabled = True End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click 'permite editar socio n = ListBox2.Items.Count m = ListBox3.Items.Count a = ListBox2.SelectedIndex b = ListBox3.SelectedIndex 'verificar cual es la lista seleccionada para editar socio If a = -1 Then If b = -1 Then MsgBox("no se selecciono elemento a editar") Else TextBox1.Text = ListBox3.Text ListBox3.Items.RemoveAt(b) TextBox1.Focus() End If LIC. NILTHON MENACHO GONZALES
Página 45
Else TextBox1.Text = ListBox2.Text ListBox2.Items.RemoveAt(a) TextBox1.Focus() End If 'actualiza contadores TextBox2.Text = ListBox2.Items.Count TextBox3.Text = ListBox3.Items.Count TextBox4.Text = ListBox2.Items.Count TextBox5.Text = ListBox2.Items.Count + ListBox3.Items.Count If n + m = 0 Then Button3.Enabled = False Button4.Enabled = False Else Button3.Enabled = True Button4.Enabled = True End If End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged If Len(TextBox1.Text) = 0 Then Button1.Enabled = False Button2.Enabled = False Else Button1.Enabled = True Button2.Enabled = True End If End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged LIC. NILTHON MENACHO GONZALES
Página 46
n = ListBox2.Items.Count m = ListBox3.Items.Count If n + m = 0 Then Button1.Enabled = False Button3.Enabled = False Else Button1.Enabled = True Button3.Enabled = True End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load n = ComboBox1.SelectedIndex End Sub Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged n = ListBox2.Items.Count m = ListBox2.Items.Count If n + m = 0 Then Button1.Enabled = False Button3.Enabled = False Else Button1.Enabled = True Button3.Enabled = True End If End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click r = MsgBox("desea cerrar esta ventana", MsgBoxStyle.YesNo, "cerrar") If r = 6 Then End LIC. NILTHON MENACHO GONZALES
Página 47
End If End Sub
LIC. NILTHON MENACHO GONZALES
Página 48
LIC. NILTHON MENACHO GONZALES
Página 49
Public Class frmProforma Public Sub Llenar_Listas() With cboprocesador.Items .Add("Pentium II 350 Mhz") .Add("Pentium III 400 Mhz") .Add("Pentium III 500 Mhz") .Add("Pentium III 700 Mhz") End With With Listmemoria.Items .Add("32 Mb") .Add("64 Mb") .Add("128 Mb") End With With Listdisco.Items .Add("10 Gb") .Add("20 Gb") .Add("30 Gb")
End With With Listimpresora.Items .Add("Stylus Color 400") .Add("Stylus Color 500") .Add("Stylus Color 700") End With With Listscanner.Items .Add("Pequeño") .Add("Mediano") .Add("Grande") End With End Sub Private Sub frmProforma_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
LIC. NILTHON MENACHO GONZALES
Página 50
Llenar_Listas() End Sub Private Sub cboprocesador_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboprocesador.SelectedIndexChanged Select Case cboprocesador.SelectedIndex Case 0 txtPrecioProcesador.Text = "100"
Case 1 txtPrecioProcesador.Text = "150" Case 2 txtPrecioProcesador.Text = "200" Case 3 txtPrecioProcesador.Text = "300" End Select End Sub Private Sub Listmemoria_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Listmemoria.SelectedIndexChanged Select Case Listmemoria.SelectedIndex Case 0 txtPrecioMemoria.Text = "30" Case 1 txtPrecioMemoria.Text = "50" Case 2 txtPrecioMemoria.Text = "70" End Select End Sub
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click End Sub Private Sub Listdisco_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Listdisco.SelectedIndexChanged Select Case Listdisco.SelectedIndex Case 0 txtPrecioDisco.Text = "80"
LIC. NILTHON MENACHO GONZALES
Página 51
Case 1 txtPrecioDisco.Text = "100" Case 2 txtPrecioDisco.Text = "120" End Select End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged txtPrecioMonitor.Text = "150" End Sub Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged txtPrecioMonitor.Text = "200" End Sub Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged txtPrecioTeclado.Text = "15" End Sub Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged txtPrecioTeclado.Text = "30" End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkLectoraDisco.CheckedChanged gbxLectoraDisco.Enabled = chkLectoraDisco.Checked End Sub Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged txtPrecioLectoraDisco.Text = "20" End Sub Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged txtPrecioLectoraDisco.Text = "40" End Sub
LIC. NILTHON MENACHO GONZALES
Página 52
Private Sub RadioButton7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton7.CheckedChanged txtPrecioLectoraDisco.Text = "50" End Sub Private Sub chkLectoraCD_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkLectoraCD.CheckedChanged gbxLectoraCD.Enabled = chkLectoraCD.Checked End Sub Private Sub RadioButton8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton8.CheckedChanged txtPrecioLectoraCD.Text = "40" End Sub Private Sub RadioButton9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton9.CheckedChanged txtPrecioLectoraCD.Text = "50" End Sub Private Sub RadioButton10_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton10.CheckedChanged txtPrecioLectoraCD.Text = "70" End Sub Private Sub chkImpresora_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkImpresora.CheckedChanged Listimpresora.Enabled = chkImpresora.Checked End Sub Private Sub Listimpresora_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Listimpresora.SelectedIndexChanged Select Case Listimpresora.SelectedIndex Case 0 txtPrecioImpresora.Text = "100" Case 1 txtPrecioImpresora.Text = "200" Case 2 txtPrecioImpresora.Text = "300" End Select End Sub
LIC. NILTHON MENACHO GONZALES
Página 53
Private Sub chkScanner_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkScanner.CheckedChanged Listscanner.Enabled = chkScanner.Checked End Sub Private Sub Listscanner_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Listscanner.SelectedIndexChanged Select Case Listscanner.SelectedIndex Case 0 txtPrecioScanner.Text = "100" Case 1 txtPrecioScanner.Text = "200" Case 3 txtPrecioScanner.Text = "400" End Select End Sub
Private Sub Calcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calcular.Click Dim PrePro, PreMem, PreDis, PreMon, PreTec As Integer Dim PreLDi, PreLCD, PreImp, PreSca As Integer Dim TotBas, TotAcc, TotVen, TotIGV, TotPag As Single PrePro = Int(txtPrecioProcesador.Text) PreMem = Int(txtPrecioMemoria.Text) PreDis = Int(txtPrecioDisco.Text) PreMon = Int(txtPrecioMonitor.Text) PreTec = Int(txtPrecioTeclado.Text) PreLDi = Int(txtPrecioLectoraDisco.Text) PreLCD = Int(txtPrecioLectoraCD.Text) PreImp = Int(txtPrecioImpresora.Text) PreSca = txtPrecioScanner.Text.ToString TotBas = PrePro + PreMem + PreDis + PreMon + PreTec TotAcc = PreLDi + PreLCD + PreImp + PreSca TotVen = TotBas + TotAcc TotIGV = Val(0.18 * TotVen)
LIC. NILTHON MENACHO GONZALES
Página 54
TotPag = TotVen + TotIGV PrecioTotalBasica.Text = TotBas.ToString PrecioTotalAccesorios.Text = TotAcc.ToString PrecioTotalVentas.Text = TotVen.ToString TotalIGV.Text = TotIGV.ToString PrecioTotalPagar.Text = TotPag.ToString End Sub Private Sub Nuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Nuevo.Click 'Configuracion Basica cboprocesador.Text = "" txtPrecioProcesador.Text = "" txtPrecioMemoria.Text = "" txtPrecioDisco.Text = "" txtPrecioMonitor.Text = "" txtPrecioTeclado.Text = "" 'Accesorios txtPrecioLectoraDisco.Text = "" txtPrecioLectoraCD.Text = "" txtPrecioImpresora.Text = "" txtPrecioScanner.Text = "" 'Generales NombreCliente.Text = "" Telefono.Text = "" Direccion.Text = "" PrecioTotalBasica.Text = "" PrecioTotalAccesorios.Text = "" PrecioTotalVentas.Text = "" TotalIGV.Text = "" PrecioTotalPagar.Text = "" End Sub
LIC. NILTHON MENACHO GONZALES
Página 55
Private Sub Salir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Salir.Click End End Sub End Class
Sistema de Costos
LIC. NILTHON MENACHO GONZALES
Página 56
Public Class DEMO Dim suma, subtotal, total, suma2, subtotal2, total2 As Single
Private Sub DEMO_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load 'ASIGNACION DE LOS NOMBRES DEL COMBO suma = 0 subtotal = 0 total = 0 'datos del combobox del producto CBOFIJOS.Items.Add("LUZ") CBOFIJOS.Items.Add("AGUA") CBOFIJOS.Items.Add("TELEFONO") CBOFIJOS.Items.Add("d.INTERNET") 'datos del combobox del fijo CBOVARIABLES.Items.Add("a.INSUMO 1") CBOVARIABLES.Items.Add("b.INSUMO 2") CBOVARIABLES.Items.Add("c.INSUMO 3") CBOVARIABLES.Items.Add("d.INSUMO 4") CBOPRODUCTO.Items.Add("A") CBOPRODUCTO.Items.Add("B") CBOPRODUCTO.Items.Add("C") CBOPRODUCTO.Items.Add("D") End Sub Private Sub CBOVARIABLES_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CBOVARIABLES.SelectedIndexChanged Select Case CBOVARIABLES.Text.Substring(0, 1) Case"a" TXTprecio2.Text = 5 Case"b" TXTprecio2.Text = 3 Case"c" TXTprecio2.Text = 4
LIC. NILTHON MENACHO GONZALES
Página 57
Case"d" TXTprecio2.Text = 6 End Select End Sub Private Sub AGREGAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btonagrgar2.Click If Val(TXTprecio2.Text) = 0 Then Exit Sub If Val(txtcantidad2.Text) = 0 Then Exit Sub Dim linea As New ListViewItem linea = LSTVARIABLE.Items.Add(CBOVARIABLES.Text) linea.SubItems.Add(TXTprecio2.Text) linea.SubItems.Add(txtcantidad2.Text) linea.SubItems.Add(txtcantidad2.Text * TXTprecio2.Text) total2 = total2 + subtotal2 txtsubtotal2.Text = total2 'suma del subtotal2 de costos TextBox11.Text = txtsubtotal2.Text End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Val(TXTPRECIO1.Text) = 0 Then Exit Sub If Val(TXTCANTIDAD1.Text) = 0 Then Exit Sub Dim linea As New ListViewItem linea = LSTCOSTOS.Items.Add(CBOFIJOS.Text) linea.SubItems.Add(TXTPRECIO1.Text) linea.SubItems.Add(TXTCANTIDAD1.Text * TXTPRECIO1.Text) total = total + subtotal txtsubtotal1.Text = total TextBox12.Text = txtsubtotal1.Text End Sub Private Sub SALIR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SALIR.Click
LIC. NILTHON MENACHO GONZALES
Página 58
Me.Hide() End Sub Private Sub ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ok.Click TextBox13.Text = Val(TextBox11.Text) + Val(TextBox12.Text) End Sub Private Sub TXTPRECIO_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TXTPRECIO1.KeyPress If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then If Val(TXTPRECIO1.Text) > 0 Then subtotal = Val(TXTCANTIDAD1.Text) * Val(TXTPRECIO1.Text) TXTTOTAL1.Text() = subtotal Button1.Focus() End If End If End Sub Private Sub txtcantidad2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtcantidad2.KeyPress If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then If Val(txtcantidad2.Text) > 0 Then subtotal2 = Val(txtcantidad2.Text) * Val(TXTprecio2.Text) txttotal2.Text() = subtotal2 btonagrgar2.Focus() End If End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click CBOFIJOS.Text = "" TXTPRECIO1.Text = "" TXTTOTAL1.Text = "" CBOFIJOS.Focus()
LIC. NILTHON MENACHO GONZALES
Página 59
End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click CBOVARIABLES.Text = "" TXTprecio2.Text = "" txtcantidad2.Text = "" txttotal2.Text = "" CBOVARIABLES.Focus() End Sub Private Sub CBOPRODUCTO_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CBOPRODUCTO.SelectedIndexChanged End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 60
Sistema de Ventas
LIC. NILTHON MENACHO GONZALES
Página 61
Public Class Form1 Dim suma, subtotal, total As Single Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load suma = 0 subtotal = 0 TOTAL = 0 CBOPRODUCTO.Items.Add("a.COCINA MABE AUTOMATICA") CBOPRODUCTO.Items.Add("b.COCINA MABE ELECTRICA") CBOPRODUCTO.Items.Add("c.COCINA MABE CONVENCIONAL") CBOPRODUCTO.Items.Add("d.LICUADORA 2 VEL.") CBOPRODUCTO.Items.Add("e.LICUADORA 4 VEL.") CBOPRODUCTO.Items.Add("F.LICUADORA 8 VEL.") CBOPRODUCTO.Items.Add("g.LICUADORA 16 VEL.") CBOPRODUCTO.Items.Add("h.LICUADORA PROFEXIONAL") CBOPRODUCTO.Items.Add("i.EQUIPO SONIDO PHILLIPS 500 W") CBOPRODUCTO.Items.Add("J.EQUIPO SONIDO PHILLIPS 1500 W") CBOPRODUCTO.Items.Add("k.EQUIPO SONIDO
SONY 500 W")
CBOPRODUCTO.Items.Add("l.EQUIPO SONIDO LG 1500 W") CBOPRODUCTO.Items.Add("m.REPRODUCTOR MP3 PHILLIPS W343") CBOPRODUCTO.Items.Add("n.REPRODUCTOR MP3 SONY SS123") End Sub Private Sub TXTCANTIDAD_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then If Val(TXTCANTIDAD.Text) > 0 Then subtotal = Val(TXTCANTIDAD.Text) * Val(TXTPRECIO.Text) TXTTOTAL.Text() = subtotal BTNAGREGAR.Focus() End If End If End Sub
LIC. NILTHON MENACHO GONZALES
Página 62
Private Sub BTNAGREGAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If Val(TXTPRECIO.Text) = 0 Then Exit Sub If Val(TXTCANTIDAD.Text) = 0 Then Exit Sub Dim linea As New ListViewItem linea.SubItems.Add(CBOPRODUCTO.Text) linea.SubItems.Add(TXTPRECIO.Text) linea.SubItems.Add(TXTCANTIDAD.Text) linea.SubItems.Add(TXTCANTIDAD.Text * TXTPRECIO.Text) TOTAL = TOTAL + subtotal TXTSUBTOTAL.Text = TOTAL
End Sub Private Sub TXTCANTIDAD_KeyPress1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TXTCANTIDAD.KeyPress If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then If Val(TXTCANTIDAD.Text) > 0 Then subtotal = Val(TXTCANTIDAD.Text) * Val(TXTPRECIO.Text) TXTTOTAL.Text() = subtotal BTNAGREGAR.Focus() End If End If End Sub Private Sub BTNAGREGAR_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNAGREGAR.Click If Val(TXTPRECIO.Text) = 0 Then Exit Sub If Val(TXTCANTIDAD.Text) = 0 Then Exit Sub Dim linea As New ListViewItem linea = LSTCOMPRA.Items.Add(CBOPRODUCTO.Text) linea.SubItems.Add(TXTPRECIO.Text) linea.SubItems.Add(TXTCANTIDAD.Text) linea.SubItems.Add(TXTCANTIDAD.Text * TXTPRECIO.Text)
LIC. NILTHON MENACHO GONZALES
Página 63
total = total + subtotal TXTSUBTOTAL.Text = total End Sub Private Sub CBOPRODUCTO_SelectedIndexChanged1(ByVal sender AsObject, ByVal e As System.EventArgs) Handles CBOPRODUCTO.SelectedIndexChanged SelectCase CBOPRODUCTO.Text.Substring(0, 1) Case"a" TXTPRECIO.Text = 500 Case"b" TXTPRECIO.Text = 700 Case"c" TXTPRECIO.Text = 400 Case"d" TXTPRECIO.Text = 100 Case"e" TXTPRECIO.Text = 150 Case"f" TXTPRECIO.Text = 200 Case"g" TXTPRECIO.Text = 250 Case"h" TXTPRECIO.Text = 300 Case"i" TXTPRECIO.Text = 500 Case"j" TXTPRECIO.Text = 750 Case"k" TXTPRECIO.Text = 600 Case"l" TXTPRECIO.Text = 800 Case"m" TXTPRECIO.Text = 125 Case"n" TXTPRECIO.Text = 150 End Select TXTCANTIDAD.Focus() End Sub
LIC. NILTHON MENACHO GONZALES
Página 64
Private Sub BTNNUEVO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNNUEVO.Click CBOPRODUCTO.Text = "" TXTPRECIO.Text = "" TXTCANTIDAD.Text = "" TXTTOTAL.Text = "" CBOPRODUCTO.Focus()
End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 65
Public Class Form1 Dim d As Single Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click d = txtDin.Text If chkcompra.Checked = True Then TextBox2.Text = d / 2.78 TextBox2.Text = FormatCurrency(TextBox2.Text) Label4.Text = "Ud. a cambiado a Dolares" End If If chkventa.Checked = True Then TextBox2.Text = d * 2.8 TextBox2.Text = FormatCurrency(TextBox2.Text) Label4.Text = "Ud. a cambiado a Soles" End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click txtDin.Text = "" TextBox2.Text = "" chkventa.Checked = False chkcompra.Checked = False txtDin.Focus() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Close() End Sub
LIC. NILTHON MENACHO GONZALES
Página 66
Public Class Form2 Dim a, a1, a2 As String Dim b, b1, b2 As String Dim c, c1, c2 As String Dim d, d1, d2 As String Dim mayor As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox4.Text = ""Then a = TextBox1.Text b = TextBox2.Text c = Val(TextBox3.Text) TextBox4.Text = a TextBox5.Text = b TextBox6.Text = c d = Val(TextBox6.Text) TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox9.Text = "" TextBox1.Focus() End If
LIC. NILTHON MENACHO GONZALES
Página 67
If TextBox7.Text = ""Then a1 = TextBox1.Text b1 = TextBox2.Text c1 = Val(TextBox3.Text) TextBox7.Text = a1 TextBox8.Text = b1 TextBox9.Text = c1 d1 = Val(TextBox9.Text) TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox12.Text = "" TextBox1.Focus() End If If TextBox10.Text = ""Then a2 = TextBox1.Text b2 = TextBox2.Text c2 = Val(TextBox3.Text) TextBox10.Text = a2 TextBox11.Text = b2 TextBox12.Text = c2 d2 = Val(TextBox12.Text) TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox1.Focus() End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If d > d1 Then
LIC. NILTHON MENACHO GONZALES
Página 68
mayor = d MsgBox(b + " Es mayor") If d2 > mayor Then mayor = d2 MsgBox(b2 + " Es mayor") Else MsgBox(b + " Es mayor") End If Else If d2 > mayor Then mayor = d2 MsgBox(b2 + " Es mayor") Else mayor = d1 MsgBox(b1 + " Es mayor") End If End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.Close() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" TextBox8.Text = ""
LIC. NILTHON MENACHO GONZALES
Página 69
TextBox9.Text = "" TextBox10.Text = "" TextBox11.Text = "" TextBox12.Text = "" TextBox1.Focus() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Form2.ActiveForm.Hide() Form1.Show() End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Form2.ActiveForm.Hide() Form3.Show() End Sub End Class
LIC. NILTHON MENACHO GONZALES
Página 70
LIC. NILTHON MENACHO GONZALES
Página 71
Public Class Form3 Dim s, sn, sa, bon As Single Dim afp, ipss As Single Dim a As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click s = Val(TextBox1.Text) a = Val(TextBox2.Text) If ((s > 500) And (a >= 10)) Then bon = s * 0.2 If a < 10 Then bon = s * 0.05 End If Else s = Val(TextBox1.Text) End If sa = s + bon afp = s * 0.1 ipss = s * 0.08 sn = sa - afp – ipss TextBox3.Text = sn TextBox4.Text = afp TextBox5.Text = ipss TextBox6.Text = sa sa = 0 afp = 0 ipss = 0 sn = 0 bon = 0 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
LIC. NILTHON MENACHO GONZALES
Página 72
TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox1.Focus() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Close() End Sub
LIC. NILTHON MENACHO GONZALES
Página 73
INCORPORAR DATOS DE OTROS APLICACIONES AL SISTEMA Primero llevamos la información de Excel hacia Access:
Luego nos aparece una ventana para poder buscar nuestro archivo de base de datos que deseamos y buscamos y le damos seleccionar y abrir:
LIC. NILTHON MENACHO GONZALES
Página 74
Luego nos va a mostrar las tablas que contiene nuestra base de datos de Access, y después seleccionaos la tabla que deseamos y le damos clic
Y finalmente nos va a mostrar el resultado de la tabla de Access:
LIC. NILTHON MENACHO GONZALES
Página 75
Y una vez tenido los resultados de la tabla de Access nos vamos a la función actualizar, luego a propiedades, esta función me va a permitir actualizar
mis datos de Excel, observa las
siguientes imágenes que te voy a presentar:
LIC. NILTHON MENACHO GONZALES
Página 76
Y luego nos aparece esta siguiente ventana:
Y activamos este checkbox que muestra la imagen y le damos a cuantos segundos quieres que se actualice tu Excel:
LIC. NILTHON MENACHO GONZALES
Página 77
View more...
Comments