[英]Sorting Numbers in Textbox in VB.Net
I need help with my program I want my output box to be in ascending order like:我的程序需要帮助 我希望我的 output 框按升序排列,例如:
0 0
1 1
2 2
3 3
4 4
5 5
6 and so on 6等
but my output is like this 1234567890 and so on.但我的 output 是这样的 1234567890 等等。
Here's my code:这是我的代码:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim count As Integer
If Integer.TryParse(TextBox1.Text, count) Then
Dim strNumbers As String = ""
For x As Integer = 0 To count - 1
strNumbers &= x
Next
TextBox2.Text = strNumbers
End If
End Sub
End Class
I believe I may have solved your problem:)我相信我可能已经解决了你的问题:)
If you change textbox2 into a rich textbox, it will now allow you to output multiple lines如果您将 textbox2 更改为富文本框,它现在将允许您 output 多行
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim count As Integer
If Integer.TryParse(TextBox1.Text, count) Then
Dim strNumbers As String = ""
For x As Integer = 0 To count - 1
strNumbers &= x & vbNewLine & vbNewLine
Next
RichTextBox1.Text = strNumbers
End If
End Sub
Here is a little something I threw together to test the output这是我为了测试 output 而拼凑起来的一些东西
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.