Este programa esta basado en calcular las ganancias diarias de un restaurante para lo cual fue necesario realizar distintos tipos de variables con sus respectivas operaciones necesarias.
Con la siguiente programacion:
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)
Text9 = (a * 2500) + (b * 1500) + (c * 2500) + (d * 3000) + (e * 2500) + (f * 1000) + (g * 3000) + (h * 2000)
Text10 = (a * 18 * 100) + (b * 18 * 100) + (c * 18 * 100) + (d * 18 * 100) + (e * 18 * 100) + (f * 18 * 100) + (g * 18 * 100) + (h * 18 * 100)
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 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()
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) = "2500"
GrdMenu.TextArray(4) = "Cerveza"
GrdMenu.TextArray(5) = "1500"
GrdMenu.TextArray(6) = "Gaseosa"
GrdMenu.TextArray(7) = "2500"
GrdMenu.TextArray(8) = "Ensalada"
GrdMenu.TextArray(9) = "3000"
GrdMenu.TextArray(10) = "Salchichas"
GrdMenu.TextArray(11) = "2500"
GrdMenu.TextArray(12) = "Refresco"
GrdMenu.TextArray(13) = "1000"
GrdMenu.TextArray(14) = "Sopa"
GrdMenu.TextArray(15) = "3000"
GrdMenu.TextArray(16) = "Postre"
GrdMenu.TextArray(17) = "2000"
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