vb.net我无法回答一个简单的循环

时间:2013-07-24 17:19:20

标签: vb.net loops for-loop

我有一个项目要将文本循环到垂直和水平

假设看起来像这样 http://pastebin.com/UJ6LZybU

请帮帮我:( 这是我试过的代码 但它只显示了单词的结尾

    Dim input As String = "HELLOWORLD"
    Dim i As Integer = 0

    For i = 0 To input.Length - 1
        Dim words As Char = input(i)
        TextBox1.Text = ("HELLOWORLD" & vbNewLine & words)
    Next

这个项目可以在任何类型的循环中回答 doloop for循环

2 个答案:

答案 0 :(得分:0)

设置TextBox1.Multiline = True并调整大小

    Dim input As String = "HELLOWORLD"

    TextBox1.Text = ("HELLOWORLD" & Environment.NewLine)
    For i As Integer = 1 To input.Length - 1
        TextBox1.Text &= (input(i) & Environment.NewLine)
    Next

答案 1 :(得分:0)

这应该这样做:

Dim i As Integer
Dim input As String = "HELLOWORLD"
TextBox1.Text = input 

For i = 1 To input.Length - 1
    TextBox1.Text &= vbNewLine & input(i)
Next