Visual Basic向列表框添加数字循环 [英] Visual basic adding number loops to listbox

查看:117
本文介绍了Visual Basic向列表框添加数字循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的代码循环并连续几年添加到列表框中。



这是我的循环代码块:



Do intNumberOfEntries> MaxNumberOfEntries



decTotalMortgage = decDownPayments *(1 + decInterest)



lstTotalPerYear.Items.Add(decTotalMortgage)



decTotalMortgage + = decDownPayments



intNumberOfEntries = intNumberOfEntries + 1





循环





现在当我在列表框中显示结果时它只是循环相同的抵押贷款。



例如第一年是100我想将其添加到第二年并显示下一个结果然后将其添加到第3年并显示在列表框中,直到达到我输入的年份数。



谢谢



我尝试了什么:



我在第一年循环相同的数字,但我想要它每年加起来。

I would like my code to loop and add consecutive years to a listbox.

this is my loop code block:

Do Until intNumberOfEntries > MaxNumberOfEntries

decTotalMortgage = decDownPayments * (1 + decInterest)

lstTotalPerYear.Items.Add(decTotalMortgage)

decTotalMortgage += decDownPayments

intNumberOfEntries = intNumberOfEntries + 1


Loop


right now when i display the result in the listbox it just loops the same mortgage.

for example the first year is 100 i would like to add that to the second year and display that result next and then add it to the 3rd year and display in the listbox and so on until it reach the number of year i inputed .

thanks

What I have tried:

im at the point where it loops the same number for the first year but i want it to add up each year.

推荐答案

添加第二个厕所p循环你的岁月。使用VB.NET或VB6标记您的问题,但如果您使用VB6,我无法想象为什么'
Add a second loop that loops through your years. Tag your question with VB.NET or VB6, although if you're using VB6, I can't imagine why'


这篇关于Visual Basic向列表框添加数字循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆