473,396 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Adding totals from CheckBox Controls and display in labels

I need help on this im stuck...

I am supposed to add price of the selected accessories and exterior finish if they have been checked, and display the result in Subtotal. Calculate sales tax on subtotal and display the result in Total label, and finally subract the trade-in allowance from the Total label to get Amount due. I have developed the code but my problem is that when i check the checkboxes the totals are not displayed, but if i dont check the checkboxes the totals are displayed.

Expand|Select|Wrap|Line Numbers
  1. Private Sub CalcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalcButton.Click
  2.         'declaring local variables
  3.         Dim sngBasePrice, sngAllowancePrice, msngSubTotal, sngSalesTax, _
  4.         sngTotalPrice, sngGrandTotal As Single
  5.         Dim sngStereo, sngLeather, sngNavigation, sngStandard, sngPearlized, _
  6.         sngCustomized, sngTaxRate As Single
  7.         sngStereo = 425.76
  8.         sngLeather = 987.41
  9.         sngNavigation = 1741.23
  10.         sngPearlized = 345.72
  11.         sngCustomized = 599.99
  12.         sngTaxRate = 0.08
  13.         'assigning values to variables
  14.         sngBasePrice = Val(Me.BasePriceTextBox.Text)
  15.         sngAllowancePrice = Val(Me.TradeInAllowanceTextBox.Text)
  16.         'checking which TexBox was clicked, and adding neccesary amount
  17.         Select Case True
  18.             Case Me.StereoCheckBox.Checked
  19.                 msngSubTotal = sngStereo + sngBasePrice
  20.             Case Me.LeatherCheckBox.Checked
  21.                 msngSubTotal = sngLeather + sngBasePrice
  22.             Case Me.NavigationCheckBox.Checked
  23.                 msngSubTotal = sngNavigation + sngBasePrice
  24.             Case Me.StandardCheckBox.Checked
  25.                 msngSubTotal = sngStandard + sngBasePrice
  26.             Case Me.PearlizedCheckBox.Checked
  27.                 msngSubTotal = sngPearlized + sngBasePrice
  28.             Case Me.CustomizedCheckBox.Checked
  29.                 msngSubTotal = sngCustomized + sngBasePrice
  30.             Case Else 'calculations
  31.                 msngSubTotal = sngBasePrice
  32.                 sngSalesTax = msngSubTotal * sngTaxRate
  33.                 sngTotalPrice = msngSubTotal + sngSalesTax
  34.                 sngGrandTotal = sngTotalPrice - sngAllowancePrice
  35.                 'display the total amounts in label controls
  36.                 Me.SubTotalLabel.Text = msngSubTotal
  37.                 Me.TotalPriceLabel.Text = sngSalesTax
  38.                 Me.AmountDueLabe.Text = sngGrandTotal
  39.         End Select
  40.     End Sub
  41. End Class
  42.  
Aug 10 '13 #1
0 1119

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Robin | last post by:
I need to add a checkbox to the common dialog control for opening files. I know it is possible to customize the common dialog thru API. But the sample codes I have seen were too long and...
6
by: Liz | last post by:
In VB.NET I add user defined controls to the main panel of a form :- Dim controlInfo As MainTemplate controlInfo = New Details controlInfo.Dock = DockStyle.Fill ' remove the old one if one...
1
by: seanmayhew | last post by:
I have a form page that that while editing saves the data to an xml doc before submitting to db. On each page unload it saves the xmldoc as the user can add multiple items to the company like...
0
by: Grandpa0594 | last post by:
This has been bothering me for some time now and perhaps someone can help me. I'm using VB.Net. I created a form that I will be using to call all the rest of my forms from. (MainMenu). Then I began...
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
0
by: John | last post by:
I have a gridview where I need to add totals for each grouped data, example my grid looks like this Sales 2006: BMW 100 Lexus 75 Mercedes 70 Total Sales: 245
1
by: Doogie | last post by:
Why is this code not allowing me to add a checkbox to it? <asp:repeater ID="RptTrip" Runat="server" EnableViewState="false"> <ItemTemplate> <asp:Checkbox AutoPostBack="True" ID="cb"...
0
by: Nathan Sokalski | last post by:
In the RadioButton and CheckBox controls, there is no Value attribute. The html <inputtag has a value attribute, which is used by both type="radio" and type="checkbox". The RadioButtonList and...
0
by: creejohn | last post by:
Hi all-- I'm really stumped here. I have a (c# 2.0) calendar control that loads a menu for each day inside the cell corresponding to that day in the dayrender event. That is all working great. I...
2
by: realtammie | last post by:
Hi, I got the following code from a post in these forums and the solution was provided by Bob Burrows. <% dim cn, rs set cn = Server.CreateObject("ADODB.Connection") set rs =...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.