programa para hallar el total a pagar de un restaurante.
la siguente es la 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)
i = (a * GrdMenu.TextArray(3)) + (b * GrdMenu.TextArray(5)) + (c * GrdMenu.TextArray(7)) + (d * GrdMenu.TextArray(9)) + (e * GrdMenu.TextArray(11)) + (f * GrdMenu.TextArray(13)) + (g * GrdMenu.TextArray(15)) + (h * GrdMenu.TextArray(17))
Text9.Text = i
j = (i * 0.18)
Text10.Text = j
Text9.Text = (i + 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()
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) = "4000"
GrdMenu.TextArray(6) = "Gaseosa"
GrdMenu.TextArray(7) = "3000"
GrdMenu.TextArray(8) = "Ensalada"
GrdMenu.TextArray(9) = "1500"
GrdMenu.TextArray(10) = "Salchichas"
GrdMenu.TextArray(11) = "2000"
GrdMenu.TextArray(12) = "Refresco"
GrdMenu.TextArray(13) = "1000"
GrdMenu.TextArray(14) = "Sopa"
GrdMenu.TextArray(15) = "1050"
GrdMenu.TextArray(16) = "Postre"
GrdMenu.TextArray(17) = "1500"
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_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text4.Text = "" Then
MsgBox ("digite un numero")
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 ("digite un numero")
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 ("digite un numero")
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 ("digite un numero")
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 ("digite un numero")
Text8.SetFocus
Else
Text8.SetFocus
End If
End If
End Sub