By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 916 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Question about numeric up/down control

P: 16
Hello...

I have designed a program to allow the user to input a future value dollar amount, interest rate, and number of years and click calculate in order to display how much money needs to be deposited at the 5, 10, 15, 20, 25, and 30 year marks within a text box. My program works and gives me the correct output with one exception. Every time I try it, it will give me the ouput for every year from 5 through 30 vice just every five years. How do I make it only give me an output at 5 year intervals? Here's part of my code that deals with it...any pointers would be greatly appreciated. Thanks.

Expand|Select|Wrap|Line Numbers
  1. ' set output header
  2.       output = "Year" & ControlChars.Tab _
  3.          & "Amount on Deposit Needed" & ControlChars.CrLf
  4.  
  5.       ' calculate amount after each year and append to string
  6.       For yearCounter = 5 To years
  7.          presentValue = _
  8.             futureValue / ((1 + interest / 100) ^ yearCounter)
  9.          output &= (yearCounter & ControlChars.Tab & _
  10.             String.Format("{0:C}", presentValue) & ControlChars.CrLf)
  11.       Next
  12.  
  13.       resultTextBox.Text = output ' display result
Apr 20 '07 #1
Share this Question
Share on Google+
2 Replies


SammyB
Expert 100+
P: 807
For yearCounter = 5 To years Step 5
Apr 20 '07 #2

P: 16
For yearCounter = 5 To years Step 5
Hey...thanks alot! I can't believe I forgot about Step. I appreciate it.
Apr 21 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.