【问题标题】:Creating loops on VB.net window forms在 VB.net 窗口窗体上创建循环
【发布时间】:2016-11-16 11:06:49
【问题描述】:

我刚开始学习编程并在 5 天前开始使用 VB.net。我从 Visual Studio 上的窗口窗体开始,我被分配在我的数学计算练习中插入一个 loop 方法,以使程序运行直到我退出而不是运行一次。提前致谢,请注意我是初学者,不要使用控制台练习或其他方法,请使用 windows 窗体

【问题讨论】:

  • YouTube 上有很多关于循环的教程,你应该先去那里,看看,写一些代码,然后如果失败,在你的问题中发布你的代码,我们可以帮助你,据说你想要寻找 While 循环”,正如一些人所说的那样,它看起来像'While True'做某事'End While'
  • 您也是本网站的新手,因此您应该阅读How to Ask 并同时阅读Tour之前 b> 你又发帖了。

标签: vb.net


【解决方案1】:

在这里您可以找到如何在 vb.net 中使用 while 语句:

https://msdn.microsoft.com/de-de/library/zh1f56zs.aspx

Dim index As Integer = 0
While index < 100000
index += 1

' If index is between 5 and 7, continue
' with the next iteration.
If index >= 5 And index <= 8 Then
    Continue While
End If

' Display the index.
Debug.Write(index.ToString & " ")

' If index is 10, exit the loop.
If index = 10 Then
    Exit While
End If
End While

Debug.WriteLine("")
' Output: 1 2 3 4 9 10

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-10-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-21
相关资源
最近更新 更多