0
labelsample.text = abcdefghijklmnopqrstuvwxyz123456789如何使用新的生產線,如果字符超過25
If samplelabel.textlength = 25 then
'How to move it to nextline?
輸出應該是這樣的:
abcdefghijklmnopqrstuvwx
z123456789
labelsample.text = abcdefghijklmnopqrstuvwxyz123456789如何使用新的生產線,如果字符超過25
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