Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old November 12th, 2004, 05:17 PM
letsberealistic letsberealistic is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 5 letsberealistic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Need help with Cash Register Application in VB.NET

I am supposed to build a Cash Register Application using Select Case statement. The Sales Tax needs to be calculated for the
amount purchased. I am supposed to add the sales tax to the subtotal and add the subtotal to the total. The Select Case statement
was used to enter the TaxRate and I think I am supposed to multiply the TaxRate by the TaxValue. I am having trouble with the button Enter key and the button Total key. When I enter a number such as $25.00, the $25.00 will show up in the subtotal, but when I enter $25.00 again it freezes up. Please help. I am new to VB and I really do not know what the heck I am doing.

' Private Sub txtCurrentPrice_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCurrentPrice.TextChanged

'(I DO NOT KNOW WHAT THIS HANDLER IS SUPPOSED TO DO)

' End Sub

PrivateSub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click

'This handler is supposed to add the current amount to the subtotal and display new

'subtotal.

Dim sngCurrentPrice AsSingle

sngCurrentPrice = Val(txtCurrentPrice.Text)

Dim sngSubtotalValue AsSingle

sngSubtotalValue = Val(lblSubtotalValue.Text)

Dim sngTaxValue AsSingle

sngTaxValue = Val(lblTaxValue.Text)



sngSubtotalValue += sngCurrentPrice

txtCurrentPrice.Text = ""

lblSubtotalValue.Text =
String.Format("{0:C}", sngSubtotalValue)

EndSub'btnEnter_Click

PrivateSub btnTotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTotal.Click

'This handler is supposed to use the subtotal to compute the tax amount.

Dim sngCurrentPrice AsSingle

sngCurrentPrice = Val(txtCurrentPrice.Text)

Dim sngSubtotalValue AsSingle

sngSubtotalValue = Val(lblSubtotalValue.Text)

Dim sngTaxValue AsSingle

sngTaxValue = Val(lblTaxValue.Text)

Dim decTaxRate AsString

SelectCase sngCurrentPrice

'amounts under $100

CaseIs < 100

decTaxRate = 0.05
'Sales Tax

'amounts between $100 and $500

Case 100 To 500

decTaxRate = 0.075
'sales tax

'amounts above $500

CaseIs > 500

decTaxRate = 0.1
'sales tax

'if no other case is true

CaseElse

decTaxRate = 0.0 'sales tax

EndSelect

'lblTaxValue.Text = strTaxRate

Dim dblTotalValue AsDouble

dblTotalValue = Val(lblTotalValue.Text)

lblTaxValue.Text = decTaxRate

'sngTaxValue += sngSubtotalValue

'dblTotalValue = sngSubtotalValue + decTaxRate

'dblTotalValue = sngSubtotalValue + (sngCurrentPrice * decTaxRate) 'or

dblTotalValue = dblTotalValue + (sngCurrentPrice * decTaxRate)

lblSubtotalValue.Text =
String.Format("{0:C}", sngSubtotalValue)

lblTaxValue.Text =
String.Format("{0:C}", sngTaxValue)

EndSub'btnTotal_Click


Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Need help with Cash Register Application in VB.NET


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway