PMT Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Having problems getting the PMT function working. I'm new to programming, and I read the tech notes On how to set up. But it still doesn't work. Can somebody just give me an example the proper way to set up. I'm woking on a LOAN program
TIA

Rudy
 
* "=?Utf-8?B?UnVkeQ==?= said:
Having problems getting the PMT function working. I'm new to
programming, and I read the tech notes On how to set up. But it still
doesn't work. Can somebody just give me an example the proper way to set
up. I'm woking on a LOAN program.

What's the problem?!
 
----- Herfried K. Wagner [MVP] wrote: -----

* "=?Utf-8?B?UnVkeQ==?= said:
Having problems getting the PMT function working. I'm new to
programming, and I read the tech notes On how to set up. But it still
doesn't work. Can somebody just give me an example the proper way to set
up. I'm woking on a LOAN program.

What's the problem?!

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Sorry, didn't mean to be vauge. Here is my PMT function that I set up.

Function Pmt(ByVal interestRate As Single, ByVal Months As Single, ByVal LoanAmount As Single)


End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim LoanAmount As Single
Dim LoanPayment As Single
Dim InterestRate As Single
Dim Months As Single

LoanAmount = LoanAmounttxt.Text
InterestRate = interestratetxt.Text
Months = monthstxt.Text

LoanPayment = Pmt(InterestRate / 12, Months * 12, LoanAmount)

MonthPaymentstxt.Text = LoanPayment

Everytime I run my program, I just get a 0. I have no syntax errors and it builds OK. I have been reading conflicting articles. Some say Dim as Single, other say Dim as Double. And I have been trying to find an example of this type of program that I can see what I'm doing wrong. Compare notes. I'm not even sure if I'm doing the PMT function right. I did import SYSTEM.MATH. Again, I'm new at this, and making this program on my own, and not doing a lab like I have been or the past year. This is the first time at writing my own program without copying it from a book. I though it would be good expierence.

Thanks for your interest.

Rudy
 
Rudy said:
Sorry, didn't mean to be vauge. Here is my PMT function that I
set up.

Function Pmt(ByVal interestRate As Single, ByVal Months As Single,
ByVal LoanAmount As Single)


End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim LoanAmount As Single
Dim LoanPayment As Single
Dim InterestRate As Single
Dim Months As Single

LoanAmount = LoanAmounttxt.Text
InterestRate = interestratetxt.Text
Months = monthstxt.Text

LoanPayment = Pmt(InterestRate / 12, Months * 12, LoanAmount)

MonthPaymentstxt.Text = LoanPayment

Everytime I run my program, I just get a 0. I have no syntax errors
and it builds OK. I have been reading conflicting articles. Some
say Dim as Single, other say Dim as Double. And I have been trying
to find an example of this type of program that I can see what I'm
doing wrong. Compare notes. I'm not even sure if I'm doing the PMT
function right. I did import SYSTEM.MATH. Again, I'm new at this,
and making this program on my own, and not doing a lab like I have
been or the past year. This is the first time at writing my own
program without copying it from a book. I though it would be good
expierence.

What do you expect? Your PMT function is empty. Consequently it returns zero
(or Nothing).

You should also enable Option Strict in the project properties to be
notified about possible bugs at compile time.
 
----- Armin Zingler wrote: -----

Rudy said:
System.EventArgs) Handles Button1.Click
Dim LoanPayment As Single
Dim InterestRate As Single
Dim Months As Single
InterestRate = interestratetxt.Text
Months = monthstxt.Text
and it builds OK. I have been reading conflicting articles. Some
say Dim as Single, other say Dim as Double. And I have been trying
to find an example of this type of program that I can see what I'm
doing wrong. Compare notes. I'm not even sure if I'm doing the PMT
function right. I did import SYSTEM.MATH. Again, I'm new at this,
and making this program on my own, and not doing a lab like I have
been or the past year. This is the first time at writing my own
program without copying it from a book. I though it would be good
expierence.

What do you expect? Your PMT function is empty. Consequently it returns zero
(or Nothing).

You should also enable Option Strict in the project properties to be
notified about possible bugs at compile time.


--
Armin

Thanks for the tip about Option Strict, I forgot about that. It sure helps alot and shows how wrong my code is.

I didn't think it was empty, I thought by putting the "name" in, it was the same as putting the number in that the user would put in the textbox. I guess I still don't understand what I need to put in the PMT function.
Thanks for all your help!

Rudy
 
rudy said:
What do you expect? Your PMT function is empty. Consequently it
returns zero (or Nothing).

You should also enable Option Strict in the project properties
to be notified about possible bugs at compile time.

Thanks for the tip about Option Strict, I forgot about that. It
sure helps alot and shows how wrong my code is.

I didn't think it was empty, I thought by putting the "name" in, it
was the same as putting the number in that the user would put in the
textbox. I guess I still don't understand what I need to put in the
PMT function. Thanks for all your help!

Sorry, I don't know what you need to put in it because I don't know what you
expect the function to do. You need to write the code that does what you
need.
 
Armin Zingler said:
Sorry, I don't know what you need to put in it because I don't know
what you expect the function to do. You need to write the code that
does what you need.

Now I see what you want. The Pmt function is part of the Microsoft Visual
Basic library, so you don't need to write it at all on your own. Delete your
empty function and the code should work.

The function is part of the Module 'Microsoft.VisualBasic.Financial' in the
MSVB library. All members (incl. functions) in a Module can be accessed
without using a qualified name. Means: you can simply write

variable = pmt(...)

You don't have to write

variable = Microsoft.VisualBasic.Financial.Pmt(...)

but it would work also.
 
I will try that Armin. Thanks for all your help on this. I really appreciate it. Like I said, I'm still learning, but I wanted to start doing stuff on my own, experience always seems to be the best teacher. It's nice to see there are people who are willing to share the knowledge. I'm going to work on this tonite, I'll keep you updated

Rudy
 
Back
Top