Rich Text Box Question

sradel

Member
Joined
Aug 4, 2005
Messages
10
Programming Experience
1-3
I wrote a little app that has the ability to change, add, or delete a line of text in multiple txt files by pulling each one into a rich text box, changing the text line, and then saving the changes back to the file. Every thing works seems to work ok.

The only issue i have is that when i add a new line to the bottome of the rich text box and there are empty lines imported from the text file, then the text will be written after the blank lines.

Is there any way to remove empty lines from a text file or rich text box before i add the line or import the file?

thanks

Scott
 
Thanks, but the code i have works fine. I pull the file into a RTB to enable the user to manually edit it. This made it easy to also pull it in when a line is being Added, Changed, or deleted in batch using a pause so the user can see the files being changed. I have no idea why they wanted this. But all this works just fine. The one thing i do not know how to do is remove empty lines from a rich text box. I just recieved a code snippet from another forum, i will try it and if it works will post it here for others to reference. thanks for your time.
 
THis is the code that works. thanks for the help.

Dim
GoodLines As New List(Of String)
For Each s As String In frmMain.rtbEditor.Lines
If Not s.Trim.Equals(String.Empty) Then
GoodLines.Add(s)
End If
Next
frmMain.rtbEditor.Lines = GoodLines.ToArray
 
Back
Top