SU EDAD ES?

Este ejercicio sirve para calcular la edad de una persona dando la fecha de nacimiento :

CÓDIGO
Private Sub Command1_Click() Dim a As Date, b As Integer a = CDate(Text1.Text) b = CInt((Date - a) / 365) Text2.Text = Str(b) & "años" End Sub

Private Sub Command2_Click() Text1.Text = "" Text2.Text = "" End Sub

Private Sub Command3_Click() End End Sub

RESTAURANTE
Esta aplicación calcula el total de ventas en el día y también los impuestos a pagar como son (18*100)

CÓDIGO
Private Sub Command1_Click() Dim A, B, C, D, E, F, G, H, I, J As Integer A = Val(Text1.Text) B = Val(Text2.Text) C = Val(Text3.Text) D = Val(Text4.Text) E = Val(Text5.Text) F = Val(Text6.Text) G = Val(Text7.Text) H = Val(Text8.Text) I = (A * 2.5) + (B * 4) + (C * 3) + (D * 1.5) + (E * 2) + (F * 1) + (G * 1.5) + (H * 1.5) J = (I * 0.18) Text9.Text = I + J Text10.Text = J 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 Form_Load() 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) = "2.50" GrdMenu.TextArray(4) = "Cerveza" GrdMenu.TextArray(5) = "4.00" GrdMenu.TextArray(6) = "Gaseosa" GrdMenu.TextArray(7) = "3.00" GrdMenu.TextArray(8) = "Ensalada" GrdMenu.TextArray(9) = "1.50" GrdMenu.TextArray(10) = "Salchichas" GrdMenu.TextArray(11) = "2.00" GrdMenu.TextArray(12) = "Refresco" GrdMenu.TextArray(13) = "1.00" GrdMenu.TextArray(14) = "Sopa" GrdMenu.TextArray(15) = "1.50" GrdMenu.TextArray(16) = "Postre" GrdMenu.TextArray(17) = "1.50" End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text1.Text = "" Then MsgBox ("") 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 ("") 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 ("") 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 MsgBox ("") 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 MsgBox ("") 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 MsgBox ("") 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 MsgBox ("") 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 MsgBox ("") Text8.SetFocus Else Text9.SetFocus End If End If End Sub

CÁLCULO DE SALARIO NETO

Este Programa Sirve Para Calcular Un Salario Bruto Teniendo En Cuenta Las Horas Trabajadas Y El Pago Por Cada Una De Ellas, El Descuento De Un 20 % Con Respecto Al Salario Bruto Y Un Salario Neto Que Implica La Resta De El Salario Bruto Con El Descuento.

CÓDIGO
Private Sub Command1_Click() Dim HorasTrabajadas As Integer HorasTrabajadas = Val(Text2.Text) Dim PagoPorHora As Integer PagoPorHora = Val(Text3.Text) Text4.Text = HorasTrabajadas * PagoPorHora Dim SalarioBruto As Integer

SalarioBruto = Val(Text4.Text) Text5.Text = 0.2 * SalarioBruto Dim Descuento As Integer Descuento = Val(Text5.Text) Text6.Text = SalarioBruto - Descuento 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 un numero") 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 un numero") 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 un numero") Text3.SetFocus Else Text4.SetFocus End If End If End Sub

Private Sub Text4_Click() Text4.Text = HorasTrabajadas * PagoPorHora End Sub

Private Sub Text5_Click() Text5.Text = 0.2 * SalarioBruto End Sub

Private Sub Text6_Click() Text6.Text = SalarioBruto - Descuento End Sub

Sign up to vote on this title
UsefulNot useful