473,378 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Question about numeric up/down control

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
2 2269
SammyB
807 Expert 512MB
For yearCounter = 5 To years Step 5
Apr 20 '07 #2
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

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

Similar topics

14
by: 2mc | last post by:
Generally speaking, if one had a list (from regular Python) and an array (from Numerical Python) that contained the same number of elements, would a While loop or a For loop process them at the...
4
by: Shane | last post by:
Hello, I'm pretty new to setting up databases, but so far I'm getting along swimmingly. But I have one question. I'm setting up a database for a client who wants to sell tickets to their theater...
8
by: Sue | last post by:
In this code why is it that when I press the SUBMIT button the focus only goes back to the Numeric field. What do I need to do to correct this problem? Sue <html>
5
by: lkrubner | last post by:
I know I'm missing something obvious, but I looked hard at this page and did not see the format of the return specified: http://us3.php.net/manual/en/function.ord.php >From the limited example...
2
by: MrNobody | last post by:
I just noticed that a numeric up/down will let you manually type in any number even if it is beyond the min/max range you specified. The control will not actually return this value if it is...
6
by: Kunkel | last post by:
Hi All i am trying to determine which button was clicked (up or down) on a numeric up down control. dotting into the e or sender objects do not provide any usefill information i need to execute...
90
by: John Salerno | last post by:
I'm a little confused. Why doesn't s evaluate to True in the first part, but it does in the second? Is the first statement something different? False print 'hi' hi Thanks.
6
by: Jon Slaughter | last post by:
I would like to use the numericUpDown in it standard way but have to features. I would like to display items instead of numbers that amp to the numbers and have the control be "cyclic" in the sense...
1
by: =?Utf-8?B?Q2hyaXMgRGF2b2xp?= | last post by:
Environment: VS 2005 Differences using VB.Net vs C#.Sharp I've got a question about Visual Studio 2005. In VB.Net when I'm in code view and I want to look at the events for a control (ie; like...
0
by: joey.powell | last post by:
Hello guys. I have a Windows forms app where I need to use a couple of numeric up/down controls. I am having a problem with them because I cannot set the control to ReadOnly (I need for users to be...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.