Visual Basic has some built in financial calculations.
The following is how I would code it in VB. Any thoughts on C# equivalent? It is computing a payment amount for a loan.
Payment = Pmt(APR2 / 12, TotPmts, -PVal, FVal, PayType2);
Printable View
Visual Basic has some built in financial calculations.
The following is how I would code it in VB. Any thoughts on C# equivalent? It is computing a payment amount for a loan.
Payment = Pmt(APR2 / 12, TotPmts, -PVal, FVal, PayType2);
Hi again,
There isn't an equivalent function in C#. However, you can add a reference to the Microsoft.VisualBasic.DLL in your C# project and use its functions. I don't imagine that this is often a great idea, but regarding the financial functions, there are some good ones in VB, so I've used them like this before.
1) Add a reference to Microsoft.VisualBasic DLL in your project.
2) Add
to the top of the class where you want to use your financial functions.Code:using Microsoft.VisualBasic;
3) Use your Pmt function as so:
Code:Financial.Pmt(Rate, NPer, PV, FV, Due);
I will give it a shot and report back.
That didn't work. Looks like I need to get my accountign book out and do it from scratch.
It works. What is the problem?
I got to that point. I needed to add Math.abs(Financial.Pmt...