Click here to Skip to main content
15,900,378 members
Home / Discussions / C#
   

C#

 
AnswerRe: Appending Quations to a string Pin
Subin Mavunkal20-Mar-12 23:17
Subin Mavunkal20-Mar-12 23:17 
AnswerRe: Appending Quations to a string Pin
Pete O'Hanlon21-Mar-12 3:53
mvePete O'Hanlon21-Mar-12 3:53 
GeneralRe: Appending Quations to a string Pin
PIEBALDconsult21-Mar-12 4:53
mvePIEBALDconsult21-Mar-12 4:53 
GeneralRe: Appending Quations to a string Pin
Pete O'Hanlon21-Mar-12 5:59
mvePete O'Hanlon21-Mar-12 5:59 
QuestionImage Encryption Pin
Hinnawi8720-Mar-12 5:14
Hinnawi8720-Mar-12 5:14 
GeneralRe: Image Encryption Pin
harold aptroot20-Mar-12 5:37
harold aptroot20-Mar-12 5:37 
AnswerRe: Image Encryption Pin
OriginalGriff20-Mar-12 5:40
mveOriginalGriff20-Mar-12 5:40 
QuestionMortgage Calculator Error Pin
Xonel20-Mar-12 3:32
Xonel20-Mar-12 3:32 
Hi,

I have this error in my code that am having difficulties in rectifying it. Initially, my code looked like this..

C#
private void CalculateTheMortgage()
      {
          //  (Loan Value) *  (1 + r/12) ^ p =  (12x / r)  *  ((1 + r/12)^p - 1)
          // payment = (((Loan Value) *  (1 + r/12) ^ p) * r)/ (12 * ((1 + r/12)^p - 1)));
          double loanAmount = (double)txtLoanAmount.CurrentValue;  // price of total mortgage before down payment
          double taxesPerYear = (double)txtPropertyTax.CurrentValue; // this will divided by 12 and added to the monthly payment
          double downPayment = (double)txtDownPayment.CurrentValue; // down payment will be subtracted from the loan
          double interestRate = (double)udInterest.Value / 100;  // calculate interest from 100%
          double termOfLoan = (double)(udTerm.Value * 12); // monthly term
          double propertyTax = (double)txtPropertyTax.CurrentValue;
          double insurance = (double)txtInsurance.CurrentValue;

         double payment =  (loanAmount - downPayment) * (Math.Pow((1 + interestRate/12), termOfLoan) * interestRate)/(12 * (Math.Pow((1+interestRate/12), termOfLoan) - 1));

         // add on a monthly property tax
         payment = payment + (propertyTax + insurance) / 12;

         txtPayment.CurrentValue = (int)payment;
      }


and i changed it a little to this...

C#
private void CalculateTheMortgage()
      {
          //  (Loan Value) *  (1 + r/12) ^ p =  (12x / r)  *  ((1 + r/12)^p - 1)
          // payment = (((Loan Value) *  (1 + r/12) ^ p) * r)/ (12 * ((1 + r/12)^p - 1)));
          double loanAmount = Convert.ToDouble(txtLoanAmount.Text);// price of total mortgage before down payment
          double taxesPerYear = Convert.ToDouble(txtPropertyTax.Text); // this will divided by 12 and added to the monthly payment
          double downPayment = Convert.ToDouble(txtDownPayment.Text); // down payment will be subtracted from the loan
          double interestRate = (double)udInterest.Value / 100;  // calculate interest from 100%
          double termOfLoan = (double)(udTerm.Value * 12); // monthly term
          double propertyTax = Convert.ToDouble(txtPropertyTax.Text);
          double insurance = Convert.ToDouble(txtInsurance.Text);


          double payment = (loanAmount - downPayment) * (Math.Pow((1 + interestRate / 12), termOfLoan) * interestRate) / (12 * (Math.Pow((1 + interestRate / 12), termOfLoan) - 1));

          // add on a monthly property tax
          payment = payment + (propertyTax + insurance) / 12;


          txtPayment.CurrentValue = (int)payment;
      }


which removed the error message below. Now i wanna change this
C#
txtPayment.CurrentValue = (int)payment;
piece of code so that the same error cannot occur again. There is a blue line under 'CurrentValue'
This is the error am getting...

C#
'System.Windows.Forms.TextBox' does not contain a definition for 'CurrentValue' and no extension method 'CurrentValue' accepting a first argument of type 'System.Windows.Forms.TextBox' could be found (are you missing a using directive or an assembly reference?)


Please help me here
Thanks
AnswerRe: Mortgage Calculator Error Pin
PIEBALDconsult20-Mar-12 3:37
mvePIEBALDconsult20-Mar-12 3:37 
GeneralRe: Mortgage Calculator Error Pin
Xonel20-Mar-12 3:44
Xonel20-Mar-12 3:44 
AnswerRe: Mortgage Calculator Error Pin
ZurdoDev20-Mar-12 4:33
professionalZurdoDev20-Mar-12 4:33 
AnswerRe: Mortgage Calculator Error Pin
JF201520-Mar-12 3:48
JF201520-Mar-12 3:48 
GeneralRe: Mortgage Calculator Error Pin
Xonel20-Mar-12 3:55
Xonel20-Mar-12 3:55 
AnswerRe: Mortgage Calculator Error Pin
V.20-Mar-12 3:54
professionalV.20-Mar-12 3:54 
GeneralRe: Mortgage Calculator Error Pin
DaveyM6920-Mar-12 5:08
professionalDaveyM6920-Mar-12 5:08 
GeneralRe: Mortgage Calculator Error Pin
V.20-Mar-12 6:20
professionalV.20-Mar-12 6:20 
GeneralRe: Mortgage Calculator Error Pin
PIEBALDconsult20-Mar-12 6:07
mvePIEBALDconsult20-Mar-12 6:07 
GeneralRe: Mortgage Calculator Error Pin
BobJanova21-Mar-12 3:21
BobJanova21-Mar-12 3:21 
QuestionProgram to find color of the pixels being selected in a picture Pin
Supztermc20-Mar-12 1:54
Supztermc20-Mar-12 1:54 
AnswerRe: Program to find color of the pixels being selected in a picture Pin
Pete O'Hanlon20-Mar-12 2:07
mvePete O'Hanlon20-Mar-12 2:07 
GeneralRe: Program to find color of the pixels being selected in a picture Pin
Supztermc20-Mar-12 2:10
Supztermc20-Mar-12 2:10 
GeneralRe: Program to find color of the pixels being selected in a picture Pin
Pete O'Hanlon20-Mar-12 2:48
mvePete O'Hanlon20-Mar-12 2:48 
GeneralRe: Program to find color of the pixels being selected in a picture Pin
wizardzz20-Mar-12 5:40
wizardzz20-Mar-12 5:40 
GeneralRe: Program to find color of the pixels being selected in a picture Pin
BobJanova21-Mar-12 3:28
BobJanova21-Mar-12 3:28 
Questionrefer to MdiParent by name Pin
Jassim Rahma20-Mar-12 1:11
Jassim Rahma20-Mar-12 1:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.