VB.NET删除文本框中空行的方法

'删除文本框中空行的方法 晨彦电脑科技 www.btoss.com


        '删除文本框中空行的方法 晨彦电脑科技 www.btoss.co
        Dim Row1, Row2 As Integer
        Dim line() As String
        Dim ArList As New ArrayList
        If Me.TextBox1.Text <> "" Then'当文本框为空时
            Row1 = Me.TextBox1.Lines.Length - 1
            For i = 0 To Row1
                If Me.TextBox1.Lines(i).ToString <> "" Then'当行不为空时
                    ArList.Add(Trim(Me.TextBox1.Lines(i).ToString))
                End If
            Next
            Row2 = ArList.Count - 1
            ReDim line(Row2)
            For i = 0 To Row2
                line(i) = ArList.Item(i).ToString
            Next
            Me.TextBox1.Lines = line
        End If
订阅评论
提醒

Captcha Code

0 评论
最旧
最新 最多投票
0
希望看到您的想法,请您发表评论x