[RESOLVED] How To Remove Extra Lines From Textbox Or RichTextBox
How To Remove Extra Lines From Textbox Or RichTextBox?
my TXTBOX look's like
----------------------------------------
NAME
NAME
--------------------------------------
How can i make it look like
------------------
NAME
NAME
------------------
i am pissed @ this plz help !!
Re: How To Remove Extra Lines From Textbox Or RichTextBox
Code:
Dim n As Long
Dim arr() As String
arr() = Split(Text1.Text, vbCrLf)
Text1.Text = vbNullString
For n = LBound(arr) To UBound(arr)
If arr(n) <> vbNullString Then
If Text1.Text <> vbNullString Then Text1.Text = Text1.Text & vbCrLf
Text1.Text = Text1.Text & arr(n)
End If
Next n
Re: How To Remove Extra Lines From Textbox Or RichTextBox
This seems to work fine, irrespective of how many extra blank lines you have in the multi-line text box:
Code:
Private Sub Command1_Click()
While InStr(Text1.Text, vbCrLf & vbCrLf)
Text1.Text = Replace(Text1.Text, vbCrLf & vbCrLf, vbCrLf)
Wend
End Sub
Private Sub Form_Load()
'Sample data with four extra blank lines
Text1.Text = "Name" & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "Name"
End Sub
Re: How To Remove Extra Lines From Textbox Or RichTextBox
wow doc....... that was brilliant......
wish i can think like u