我有一个richTextbox和一个while循环,x = 0,每次这个循环运行时,x += 1直到它达到某个值。
这就是我想要发生的事情:
while x <> 10 then
它会item 0 +1
在新行上说,然后item 1 + 1
在它下面的行上,等等,所以你会在之后看到所有 10 个值。
发生的情况是,它将将该行更改为新值。
我的问题是:我如何让它把单词放在一个新的行上?
这是我的代码:
While readListItem <> PaymentList.Items.Count
If readListItem > PaymentList.Items.Count Then
readListItem = 0
Exit While
End If
readListItem += 1
MessageBox.Show(readListItem)
resultBox.Text = vbNewLine + PaymentList.Items.Item(readListItem) + " costs " + enteredCost + "." + vbNewLine
End While
readListItem
是“x”,每次循环运行时都会被迭代 1
PaymentList
是我的列表框,其中包含一个未知值(用户设置此列表中的项目数)
The If if there because, after x = let say 10, it would add another to x (so now it = 11) and try print out the 11th item, as it doesn't exist, it crash. 这是为了防止这种情况发生。我不想尝试一下