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