Trouble Formating zones
Trouble Formating zones
Trouble Formating zones
Trouble Formating zones
Trouble Formating zones
Trouble Formating zones Trouble Formating zones Trouble Formating zones Trouble Formating zones Trouble Formating zones Trouble Formating zones Trouble Formating zones Trouble Formating zones
Trouble Formating zones Trouble Formating zones
Trouble Formating zones
Go Back  Xtreme Visual Basic Talk > > > Trouble Formating zones


Reply
 
Thread Tools Display Modes
  #1  
Old 03-31-2010, 10:19 PM
Hasimar Hasimar is offline
Newcomer
 
Join Date: Mar 2010
Posts: 9
Default Trouble Formating zones


Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
Dim Pizza, Fries, Drinks As Double 'These variables are assigned to text boxes
Dim PizzaPrice, FriesPrice, DrinksPrice As Double
'These variables are assigned to the quantity



PizzaPrice = CDbl(FormatCurrency(1.75))
FriesPrice = CDbl(FormatCurrency(2.0)) 'The prices of the items
DrinksPrice = CDbl(FormatCurrency(1.25))





Subquanity(Pizza, Fries, Drinks)
'assigns the varables to the sub procedure

DisplayTotal(Pizza, Fries, Drinks, PizzaPrice, FriesPrice, DrinksPrice)







End Sub


Sub Subquanity(ByRef pizza As Double, ByRef Fries As Double, ByRef Drinks As Double)








pizza = CDbl(txtPizza.Text)
Fries = CDbl(txtFries.Text) 'Assigns what number you type for the Quanity in each txt box
Drinks = CDbl(txtDrinks.Text)




End Sub
Sub displaytotal(ByVal pizza As Double, ByVal fries As Double, ByVal drinks As Double, _
ByVal pizzaprice As Double, ByVal friesprice As Double, ByVal drinksprice As Double)
Dim total As Double

total = Math(pizza, fries, drinks, pizzaprice, friesprice, drinksprice)


Dim fmtdouble As String = "{0, -6} {1, 40} {2, 45}"
'formats the lst box

lstResults.Items.Clear()
lstResults.Items.Add(String.Format(fmtdouble, "Item", "Quantity", "Price"))
lstResults.Items.Add(String.Format(fmtdouble, " ", " ", " "))
lstResults.Items.Add(String.Format(fmtdouble, "PizzaSlices", pizza, FormatCurrency(pizzaprice)))
lstResults.Items.Add(String.Format(fmtdouble, "fries ", fries, FormatCurrency(friesprice)))
lstResults.Items.Add(String.Format(fmtdouble, "soft drinks ", drinks, FormatCurrency(drinksprice)))
'Reason for extra spaces for fries is soft drink is because the numbers weren't lining up right.
lstResults.Items.Add(String.Format(fmtdouble, " ", " ", " "))
lstResults.Items.Add(String.Format(fmtdouble, "Total", " ", FormatCurrency(total)))


-----------------(when i press the compute button they don't all line up vertically)


End Sub

Function Math(ByVal pizza As Double, ByVal fries As Double, ByVal drinks As Double, ByVal pizzaPrice As Double, ByVal friesprice As Double, ByVal drinksprice As Double) As Double




Return (pizza * pizzaPrice) + (fries * friesprice) + (drinks * drinksprice)













End Function



End Class
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Trouble Formating zones
Trouble Formating zones
Trouble Formating zones Trouble Formating zones
Trouble Formating zones
Trouble Formating zones
Trouble Formating zones Trouble Formating zones Trouble Formating zones Trouble Formating zones Trouble Formating zones Trouble Formating zones Trouble Formating zones
Trouble Formating zones
Trouble Formating zones
 
Trouble Formating zones
Trouble Formating zones
 
-->