每秒在 VB 控制台中重复相同的操作

Repeat Same Action In VB Console every second

我想执行这段代码,可惜它只执行了一次就停止了。如何执行此代码以每秒显示一次?并在这样做100次后停止,即在固定的100秒后。

Do

    Dim index As Integer = 0

    index += 1

    Console.WriteLine(RandomString(102, 102))

    Console.ReadLine()
    Do
        Threading.Thread.Sleep(1000)
    Loop Until index = 100

Loop

试试这个:

Dim index As Integer = 0
Do Until index = 100
       index += 1

       Console.WriteLine(RandomString(102, 102))
       Threading.Thread.Sleep(1000)
Loop
Console.ReadLine()