xizardy
10-12-2009, 11:35 PM
Ok so for my class i have been working on a project and every week he adds another step to project, so basically right now i have made an invoice sheet for a computer company, the invoice sheet contains different spots on it which include (Address, name, zip,city, state, then also includes 3 spots for 3 different kind of computers, which you can enter in how many of each computer you want in each spot, also it has 3 buttons, clear, exit, and calculate also has 4 spots to where the calculated number show up when i hit calculate) So far my program works fine with all of that incorporated into it, but now we much make a UNDO button which would basically( ex: everything is filled in and then you were to hit clear on accident, you would then want your undo button undo your mistake and bring everything back on there the way it was before you hit clear). I have no clue on where to even start on this.
here is the entire code that i have inside my program i don't no if this would help at all, but here its is
'Project name: Ballard-X Computers
'Project purpose: Calculates the total number of computers ordered and the total price
'Created/revised by: Ray Ballard on 09/27/2009
Option Explicit On
Option Strict On
Option Infer On
Public Class ballardcomputerForms
Private Sub calcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calcButton.Click
'Calculate the total number of computers ordered and total price
'declare constants and variables
Const ComputerPrice As Decimal = 599.99D
Const TaxRate As Decimal = 0.05D
Dim lenovoComputers As Integer
Dim dellComputers As Integer
Dim hpComputers As Integer
Dim totalSystems As Decimal
Dim subtotal As Decimal
Dim salesTax As Decimal
Dim totalPrice As Decimal
Dim Dollars As Integer
Dim Cents As Integer
Dim dollarsLabel As Decimal
' assign user input to Variables
Integer.TryParse(lenovoTextBox.Text, lenovoComputers)
Integer.TryParse(dellTextBox.Text, dellComputers)
Integer.TryParse(hpTextBox.Text, hpComputers)
Integer.TryParse(dollarsButtonLabel.Text, Dollars)
Integer.TryParse(centsButtonLabel.Text, Cents)
' perfrom calulations
totalSystems = lenovoComputers + dellComputers + hpComputers
subtotal = totalSystems * ComputerPrice
salesTax = subtotal * TaxRate
totalPrice = subtotal + salesTax
Dollars = Convert.ToInt32(totalPrice)
Cents = Convert.ToInt32((totalPrice Mod 1) * 100)
' display calculated amounts
calcButtontotalPrices.Text = Convert.ToString(totalSystems)
calcButtontotalPriceLabel.Text = Convert.ToString(totalPrice)
calcButtontotalPriceLabel.Text = totalPrice.ToString("n2")
dollarsButtonLabel.Text = Convert.ToString(Dollars)
dollarsButtonLabel.Text = Dollars.ToString
centsButtonLabel.Text = Convert.ToString(Cents)
centsButtonLabel.Text = Cents.ToString
End Sub
Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub
Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click
' prepares the screen for the next order
nameTextBox.Text = String.Empty
addressTextBox.Text = String.Empty
cityTextBox.Text = String.Empty
stateTextBox.Text = String.Empty
zipTextBox.Text = String.Empty
lenovoTextBox.Text = String.Empty
dellTextBox.Text = String.Empty
hpTextBox.Text = String.Empty
calcButtontotalPrices.Text = String.Empty
calcButtontotalPriceLabel.Text = String.Empty
dollarsButtonLabel.Text = String.Empty
centsButtonLabel.Text = String.Empty
nameTextBox.Focus()
End Sub
End Class
ive also added the program in a zip file if you just unzip it and open you can send exactly what im looking at, please help if you are able to.
Thank You
Ray
here is the entire code that i have inside my program i don't no if this would help at all, but here its is
'Project name: Ballard-X Computers
'Project purpose: Calculates the total number of computers ordered and the total price
'Created/revised by: Ray Ballard on 09/27/2009
Option Explicit On
Option Strict On
Option Infer On
Public Class ballardcomputerForms
Private Sub calcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calcButton.Click
'Calculate the total number of computers ordered and total price
'declare constants and variables
Const ComputerPrice As Decimal = 599.99D
Const TaxRate As Decimal = 0.05D
Dim lenovoComputers As Integer
Dim dellComputers As Integer
Dim hpComputers As Integer
Dim totalSystems As Decimal
Dim subtotal As Decimal
Dim salesTax As Decimal
Dim totalPrice As Decimal
Dim Dollars As Integer
Dim Cents As Integer
Dim dollarsLabel As Decimal
' assign user input to Variables
Integer.TryParse(lenovoTextBox.Text, lenovoComputers)
Integer.TryParse(dellTextBox.Text, dellComputers)
Integer.TryParse(hpTextBox.Text, hpComputers)
Integer.TryParse(dollarsButtonLabel.Text, Dollars)
Integer.TryParse(centsButtonLabel.Text, Cents)
' perfrom calulations
totalSystems = lenovoComputers + dellComputers + hpComputers
subtotal = totalSystems * ComputerPrice
salesTax = subtotal * TaxRate
totalPrice = subtotal + salesTax
Dollars = Convert.ToInt32(totalPrice)
Cents = Convert.ToInt32((totalPrice Mod 1) * 100)
' display calculated amounts
calcButtontotalPrices.Text = Convert.ToString(totalSystems)
calcButtontotalPriceLabel.Text = Convert.ToString(totalPrice)
calcButtontotalPriceLabel.Text = totalPrice.ToString("n2")
dollarsButtonLabel.Text = Convert.ToString(Dollars)
dollarsButtonLabel.Text = Dollars.ToString
centsButtonLabel.Text = Convert.ToString(Cents)
centsButtonLabel.Text = Cents.ToString
End Sub
Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub
Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click
' prepares the screen for the next order
nameTextBox.Text = String.Empty
addressTextBox.Text = String.Empty
cityTextBox.Text = String.Empty
stateTextBox.Text = String.Empty
zipTextBox.Text = String.Empty
lenovoTextBox.Text = String.Empty
dellTextBox.Text = String.Empty
hpTextBox.Text = String.Empty
calcButtontotalPrices.Text = String.Empty
calcButtontotalPriceLabel.Text = String.Empty
dollarsButtonLabel.Text = String.Empty
centsButtonLabel.Text = String.Empty
nameTextBox.Focus()
End Sub
End Class
ive also added the program in a zip file if you just unzip it and open you can send exactly what im looking at, please help if you are able to.
Thank You
Ray