|
-
Feb 3rd, 2003, 10:27 PM
#1
Thread Starter
Addicted Member
try my code!!!
Can somone run this code for me and tell me what you think! Thanks!!
Option Explicit
Private Price1 As String, Price2 As String, Price3 As String
Dim pizzaCost As Currency
Dim TotalFrenchFryCost As Currency
Dim TotalDrinkCost As Currency
Dim GrandTotal As Currency
Private Sub Quantity()
List1.AddItem ""
List1.AddItem "Item Quantity Price"
List1.AddItem "pizza slices " & Val(Text1.Text) & " " & pizzaCost
List1.AddItem "fries " & Val(Text2.Text) & " " & TotalFrenchFryCost & ".00"
List1.AddItem "soft drinks " & Val(Text3.Text) & " " & TotalDrinkCost
List1.AddItem " " & "--------"
List1.AddItem "Total" & " " & "$" & GrandTotal
End Sub
Private Sub CostCal()
'Find Total Cost of Items
Price1 = 1.75
Price2 = 1#
Price3 = 0.75
pizzaCost = Val(Text1.Text) * Price1
TotalFrenchFryCost = Val(Text2.Text) * Price2
TotalDrinkCost = Val(Text3.Text) * Price3
GrandTotal = pizzaCost + TotalFrenchFryCost + TotalDrinkCost
End Sub
Private Sub cmdClick_Click()
CostCal
Quantity
End Sub
__________________
-
Feb 3rd, 2003, 10:32 PM
#2
well, first thing I think about when I look at that code, is that it needs indentation and [ vbcode ] [ /vbcode ] tags.
-
Feb 3rd, 2003, 10:40 PM
#3
Frenzied Member
Of course,
VB Code:
Private Price1 As String, Price2 As String, Price3 As String
Should be changed to:
VB Code:
Private Price1 As Single, Price2 As Single, Price3 As Single
Otherwise:
VB Code:
Price1 = 1.75
Price2 = 1#
Price3 = 0.75
Will not work.
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Feb 3rd, 2003, 11:29 PM
#4
Lively Member
Re: try my code!!!
Originally posted by wmosley2
List1.AddItem "Total" & " " & "$" & GrandTotal
Maybe instead of the above line you should have:
VB Code:
List1.AddItem "Total " & Format(GrandTotal, "$0.00")
Last edited by nightshift; Feb 4th, 2003 at 12:27 AM.
-
Feb 3rd, 2003, 11:42 PM
#5
PowerPoster
Well
VB Code:
List1.AddItem "Total " & FormatCurrency(GrandTotal, 2)
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|