Need Help
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Need Help

Threaded View

  1. #1
    Join Date
    Apr 2013
    Location
    USA
    Posts
    1

    Need Help

    I am writting a C# GUI program that will calculate a car payment. I keep getting an error on one line of code. All text boxes are correctly identified in the code.

    Here is the code:
    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace CarGUI
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                double CarPrice, Total;
                double CreditScore;
                double MonthlyPayment;
                double InterestRate;
                double PaymentPlan;
                CarPrice = Convert.ToDouble(textBox1);
                PaymentPlan = Convert.ToDouble(textBox3);
                CreditScore = Convert.ToDouble(textBox2);
    
                if (CreditScore <= 450)
                    InterestRate = .12;
                else if (CreditScore >= 451 && CreditScore >= 600)
                    InterestRate = .10;
                else if (CreditScore >= 601 && CreditScore >= 700)
                    InterestRate = .07;
                else 
                    InterestRate = .02;
    
                MonthlyPayment = (CarPrice / PaymentPlan) * InterestRate;
    
                label4.Text = String.Format ("Car Price {0}", CarPrice.ToString("C"));
                label5.Text = String.Format("with a credit score of {0}", CreditScore.ToString);
                label6.Text = String.Format("making your payments {0}", MonthlyPayment.ToString("C"));
    
    
    
            }
        }
    }
    Label5 line is the error that I get.
    Thanks for looking and helping.
    DK
    Last edited by BioPhysEngr; April 19th, 2013 at 10:56 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center