You are on page 1of 12

Gua De Laboratorio 1 Visual Basic

Juan Felipe Aponte Pea

Instituto integrado Antonio Nario Moniquira 2011

Gua De Laboratorio Visual Basic

Juan Felipe Aponte Pea

Presentado a: Olga Roco Berrio Leguizamn

Instituto integrado Antonio Nario Moniquira 2011

Tabla de contenido
1. 2. 3. 4. Aplicacin N 1 Salario Neto ............................................................................................... 4 Aplicacin N 2 Restaurante ................................................................................................ 6 Aplicacin N 3 Edad De Una Persona ........................................................................... 10 Aplicacin N 4 Cajero Automtico ................................................................................. 11

1. Aplicacin N 1 Salario Neto


Calcula el salario neto de un trabajador en funcin del nmero de horas trabajadas, pago por hora de trabajo y un descuento fijo al sueldo bruto del 20 por 100.

Dim N1, N2, N3, N4, N5, N6 As Double Private Sub aceptar_Click() N1 = Val(Text1) N2 = Val(Text2) N3 = Val(Text3) N4 = Val(Text4) N5 = Val(Text5) N6 = Val(Text6) Text4.Text = Text2.Text * Text3.Text Text5.Text = 0.2 * Text4.Text Text6.Text = Text4.Text - Text5.Text End Sub Private Sub Command2_Click() Text1.Text = "" Text2.Text = "" Text3.Text = ""

Text4.Text = "" Text5.Text = "" Text6.Text = "" End Sub Private Sub Command3_Click() End End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text1.Text = "" Then MsgBox ("Digite el Nombre del trabajador ") Text1.SetFocus Else Text2.SetFocus End If End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text2.Text = "" Then MsgBox ("Digite las horas trabajadas ") Text2.SetFocus Else Text3.SetFocus End If End If End Sub Private Sub Text3_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text3.Text = "" Then MsgBox ("digite valor que corresponda") Text3.SetFocus Else Text3.SetFocus End If aceptar.SetFocus End If End Sub

2. Aplicacin N 2 Restaurante

Es una aplicacin que calcula las ventas totales de todo las compras, ms un impuesto si sobrepasa la cantidad de 18.

Dim N1, N2, N3, N4, N5, N6, N7, N8 As Integer Private Sub Command1_Click() N1 = Val(Text1.Text) N2 = Val(Text2.Text) N3 = Val(Text3.Text) N4 = Val(Text4.Text) N5 = Val(Text5.Text) N6 = Val(Text6.Text) N7 = Val(Text7.Text) N8 = Val(Text8.Text) N9 = (N1 * GrdMenu.TextArray(3)) + (N2 * GrdMenu.TextArray(5)) + (N3 * GrdMenu.TextArray(7)) + (N4 * GrdMenu.TextArray(9)) + (N5 * GrdMenu.TextArray(11)) + (N6 * GrdMenu.TextArray(13)) + (N7 * GrdMenu.TextArray(15)) + (N8 * GrdMenu.TextArray(17)) Text9.Text = N9 N10 = (N9 * 0.18) Text10.Text = N10

Text9.Text = (N9 + N10) End Sub Private Sub Command2_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" Text7.Text = "" Text8.Text = "" Text9.Text = "" Text10.Text = "" End Sub Private Sub Command3_Click() End End Sub

Private Sub MSHFlexGrid1_Click() Private Sub Form_Load() GrdMenu.Cols = 2 GrdMenu.Rows = 9 GrdMenu.FixedCols = 0 GrdMenu.FixedRows = 1 GrdMenu.TextArray(0) = "Men" GrdMenu.TextArray(1) = "Precio" GrdMenu.TextArray(2) = "Hamburguesa" GrdMenu.TextArray(3) = "4000" GrdMenu.TextArray(4) = "Cerveza" GrdMenu.TextArray(5) = "1700" GrdMenu.TextArray(6) = "Gaseosa" GrdMenu.TextArray(7) = "1200" GrdMenu.TextArray(8) = "Ensalada" GrdMenu.TextArray(9) = "3500" GrdMenu.TextArray(10) = "Salchichas" GrdMenu.TextArray(11) = "1200" GrdMenu.TextArray(12) = "Refresco" GrdMenu.TextArray(13) = "100" GrdMenu.TextArray(14) = "Sopa" GrdMenu.TextArray(15) = "2500" GrdMenu.TextArray(16) = "Postre" GrdMenu.TextArray(17) = "1000" End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text1.Text = "" Then Text1.SetFocus

Else Text2.SetFocus End If End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text2.Text = "" Then Text2.SetFocus Else Text3.SetFocus End If End If End Sub Private Sub Text3_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text3.Text = "" Then Text3.SetFocus Else Text4.SetFocus End If End If End Sub Private Sub Text4_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text4.Text = "" Then Text4.SetFocus Else Text5.SetFocus End If End If End Sub Private Sub Text5_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text5.Text = "" Then Text5.SetFocus Else Text6.SetFocus End If End If End Sub Private Sub Text6_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text6.Text = "" Then Text6.SetFocus Else Text7.SetFocus

End If End If End Sub Private Sub Text7_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text7.Text = "" Then Text7.SetFocus Else Text8.SetFocus End If End If End Sub Private Sub Text8_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text8.Text = "" Then Text8.SetFocus Else Command1.SetFocus End If End If End Sub

3. Aplicacin N 3 Edad De Una Persona


Esta aplicacin, nos permite calcular la edad de una persona a partir de su fecha de nacimiento.

Private Sub CmdACEPTAR_Click() Dim FecNacAs Date, Edad As Integer FecNac = CDate(Text1.Text) Edad = CInt((Date - FecNac) / 365) Text2.Text = Str(Edad) & "aos" End Sub Private Sub cmdlimpiar_Click() Text1.Text = "" Text2.Text = "" End Sub Private Sub cmdsalir_Click() End End Sub

10

4. Aplicacin N 4 Cajero Automtico


Se tiene un cajero automtico el cual permite manipular Cierta cantidad de dinero .

Private Sub CmdAceptar_Click() Dim reti As Currency, Billete200, Billete100, Billete50, Billete20, Billete10 As Integer reti = Val(txtretiro) Billete200 = Int(reti / 200) reti = reti Mod 200 Billete100 = Int(reti / 100) reti = reti Mod 100 Billete50 = Int(reti / 50) reti = reti Mod 50 Billete20 = Int(reti / 20) reti = reti Mod 20 Billete10 = Int(reti / 10) reti = reti Mod 10 Txtbillete200 = Str(Billete200) Txtbillete100 = Str(Billete100) Txtbillete50 = Str(Billete50) Txtbillete20 = Str(Billete20)

11

Txtbillete10 = Str(Billete10) End Sub Private Sub CmdLimpiar_Click() txtretiro = "" Txtbillete10 = "" Txtbillete20 = "" Txtbillete50 = "" Txtbillete100 = "" Txtbillete200 = "" txtretiro.SetFocus End Sub Private Sub CmdSalir_Click() End End Sub

Private Sub txtretiro_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If reti = "" Then txtretiro.SetFocus Else txtretiro.SetFocus End If

cmdaceptar.SetFocus EndIf End Sub

12

You might also like