Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > Intro Programming
|
Intro Programming What is a loop? Which language is best for beginners? What is "object oreinted?" All those types of questions and more are welcome here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Intro Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 21st, 2014, 03:09 AM
Registered User
 
Join Date: Apr 2014
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Not sure if I am in the right place.

I need some help with my code. I need a messagebox to show and I know the code is right, but it only works for VB not for Visual Web Developer(2010). Could someone please look at my code to see if I have done something wrong. Thanks

Code:
 'Declare variable for the calculations.
        Dim decRoomCharges As Decimal               'Room charges total
        Dim decAddCharges As Decimal                'Additional Charges
        Dim decSubtotal As Decimal                  'Subtotal
        Dim decTax As Decimal                       'Tax
        Dim decTotal As Decimal                     'Total of all charges
        Const decTAX_RATE As Decimal = 0.08D        'Tax Rate. Consts CANNOT be changed by a programming statment

        Try
            'Calculate and display the room charges.
            decRoomCharges = CDec(txtNights.Text) *
                             CDec(txtNightlyCharge.Text)    '<---Calculating(mulitplying) the room charges
            lblRoomCharges.Text = decRoomCharges.ToString("c")  '<---Displaying decRoomCharges in lblRoomCharges

            'Calucalt and display the additional charges.
            decAddCharges = CDec(txtRoomService.Text) +
                            CDec(txtTelephone.Text) +
                            CDec(txtMisc.Text)              '<---Calculating(adding) the Additional charges
            lblAddCharges.Text = decAddCharges.ToString("c")    '<---Displayig decAdditionalCharges(decAddCharges
            'in lblAddCharges.

            'Calculate and display the subtotal.
            decSubtotal = decRoomCharges + decAddCharges '<---Calculating the Subtotal
            lblSubtotal.Text = decSubtotal.ToString("c")  '<---Displaying decSubtotal in lblSubtotal

            'Calculate and display the tax.
            decTax = decSubtotal * decTAX_RATE '<---Calculating(multiplying) the Tax
            lblTax.Text = decTax.ToString("c")  '<---Displaying decTax in lblTax

            'Calculate and display the total charges.
            decTotal = decSubtotal + decTax     '<---Calculating(adding) the Total Charges
            lblTotal.Text = decTotal.ToString("c")  '<---Displaying decTotal in lblTotal.

            'Change and display the total charges.
            lblTotal.BackColor = Drawing.Color.Blue
            lblTotal.ForeColor = Drawing.Color.White

        Catch ex As Exception
            'Error message
            MessageBox.Show("All input must be vaild numberic values.")
        End Try
Reply With Quote
  #2 (permalink)  
Old April 24th, 2014, 01:13 AM
Friend of Wrox
 
Join Date: Feb 2014
Posts: 136
Thanks: 1
Thanked 10 Times in 10 Posts
Default

Check your other post
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Footer Not In the Right Place NexusFactor BOOK: Beginning ASP.NET 4 : in C# and VB 2 December 29th, 2010 03:11 PM
footer doesn't appear in right place Rachel BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 January 7th, 2009 02:44 PM
Place Holder Manoj Bisht ASP.NET 1.x and 2.0 Application Design 3 October 24th, 2007 08:52 AM
In-place precompilation AGS BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 December 3rd, 2005 07:45 PM
Logging in from another place Hadware General .NET 0 December 14th, 2004 03:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.