Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 如果字符超过25,如何使用新行_Vb.net - Fatal编程技术网

Vb.net 如果字符超过25,如何使用新行

Vb.net 如果字符超过25,如何使用新行,vb.net,Vb.net,labelsample.text=abcdefghijklmnopqrstuvxyz123456789 If samplelabel.textlength = 25 then 'How to move it to nextline? 输出应如下所示: abcdefghijklmnopqrstuvwx z123456789 使用MOD运算符决定何时插入回车符 Option Strict On Option Explicit On Option Infer Off Publ

labelsample.text=abcdefghijklmnopqrstuvxyz123456789

If samplelabel.textlength = 25 then
   'How to move it to nextline?
输出应如下所示:

  abcdefghijklmnopqrstuvwx    
  z123456789

使用MOD运算符决定何时插入回车符

Option Strict On
Option Explicit On
Option Infer Off
Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim sb As New System.Text.StringBuilder
        Dim sampleText As String = "abcdefghijklmnopqrstuvwxyz123456789"
        For i As Integer = 1 To sampleText.Length
            sb.Append(sampleText(i - 1))
            If i Mod 25 = 0 Then
                sb.AppendLine()
            End If
        Next
        Label1.Text = sb.ToString
    End Sub
End Class