在richtextbox的第二行继续写
Continue writing in a second line of richtextbox
我有一个将 int 转换为其实际字符串值的函数,当我在文本框中键入数字并且该函数将其转换为 richtextbox 时,它会一直工作。
问题是当它转换时,我想在 richtextbox 中继续写一个新行,这样它就可以在纸上打印成两行。
这是我尝试做的。
TextBox2.Text = " " & NumberToText(AmountBox.Text)
If TextBox2.Text.Length() > 60 Then
TextBox2.AppendText(Environment.NewLine)
End If
TextBox2 是我的 richtextbox 的名称,我选择了 60,这是我希望在第一行显示的平均字母数。
如何让它在第二行继续转换相同的数字?
我希望输出类似于:
Four Hundreds Twenty Three Millions Four Hundreds Twenty -line1
Five Thousands Four Hundreds Twelve -line2
有什么想法吗?
As Number to text as many return points you could use this intermediate function
Public Function NumberToTextSplitted(texto As String) As String
'Append this to what you are are already doing
Dim rtn as strin = NumberToText(texto)
Dim words As String() = rtn.Split(" ")
Dim result As String = String.Empty
For Each word As String In words
If line.Length + word.Length >= 59 Then
result &= Environment.NewLine
End If
result &= " " & word
Next
Return result
结束函数
我有一个将 int 转换为其实际字符串值的函数,当我在文本框中键入数字并且该函数将其转换为 richtextbox 时,它会一直工作。
问题是当它转换时,我想在 richtextbox 中继续写一个新行,这样它就可以在纸上打印成两行。
这是我尝试做的。
TextBox2.Text = " " & NumberToText(AmountBox.Text)
If TextBox2.Text.Length() > 60 Then
TextBox2.AppendText(Environment.NewLine)
End If
TextBox2 是我的 richtextbox 的名称,我选择了 60,这是我希望在第一行显示的平均字母数。
如何让它在第二行继续转换相同的数字?
我希望输出类似于:
Four Hundreds Twenty Three Millions Four Hundreds Twenty -line1
Five Thousands Four Hundreds Twelve -line2
有什么想法吗?
As Number to text as many return points you could use this intermediate function
Public Function NumberToTextSplitted(texto As String) As String
'Append this to what you are are already doing
Dim rtn as strin = NumberToText(texto)
Dim words As String() = rtn.Split(" ")
Dim result As String = String.Empty
For Each word As String In words
If line.Length + word.Length >= 59 Then
result &= Environment.NewLine
End If
result &= " " & word
Next
Return result
结束函数