|
-
May 15th, 2000, 11:28 PM
#1
Thread Starter
New Member
I am reading from a file and writing to another file.
I am getting an extra carriage return, after reading
from source. How could i delete extra carriage
return at end of the file.
Any light shed would be helpful.
Thanks in advance
-
May 16th, 2000, 12:11 AM
#2
Fanatic Member
t = Replace(txtFind.Text, vbCrLf, "")
Chemically Formulated As:
Dr. Nitro
-
May 16th, 2000, 12:45 AM
#3
Thread Starter
New Member
Still my problem is not solved. How do i know the
End of file. i am reading the whole file and writing to another with different name and some changes. How could i use this code and know the end of file.
i = Replace(file, vbCrLf, "")
Thanks
-
May 16th, 2000, 04:25 AM
#4
Fanatic Member
Drop two textboxes and a command button name:
txtFind
txtParagraph - set multiline = true
cmdCarriageEliminator
Code:
Option Explicit
Private Sub Form_Resize()
'vbBack
Me.WindowState = vbMaximized
cmdCarriageEliminator.Caption = "Eliminate Only Single Carriage Return - Double Carriage Return Represent Separation of Paragraph"
txtParagraph.Move 0, 0, Me.Width, Me.Height - cmdCarriageEliminator.Height * 3
txtFind.Move 0, txtParagraph.Height + 240
cmdCarriageEliminator.Move txtFind.Width + 120, txtParagraph.Height + 240, Me.Width - txtFind.Width - 120
'PURPOSE:Eliminate the following
txtFind.Text = vbCrLf
'txtParagraph.ScrollBars = vbVertical
End Sub
Private Sub cmdCarriageEliminator_Click()
'OVERALL:Search for txtFind.Text and delete it
Dim intPos As Integer
intPos = 1
Do
'PURPOSE:Look for txtFind.Text at the current intPos
intPos = InStr(intPos, txtParagraph.Text, txtFind.Text)
If intPos > 0 Then
'PURPOSE:Check if intPos + Len(txtFind.Text) is another txtFind.Text
' If there are two txtFind.Text next too
' each other, do not delete it because it
' represent a line to separate a paragraph apart.
If Mid(txtParagraph.Text, intPos + Len(txtFind.Text), Len(txtFind.Text)) = txtFind.Text Then
'Increase the intPos to skip over
intPos = intPos + Len(txtFind.Text) + Len(txtFind.Text)
Else
'PURPOSE:Replace txtFind.Text with a space
txtParagraph.Text = Left(txtParagraph.Text, intPos - 1) & " " & Mid(txtParagraph.Text, intPos + Len(txtFind.Text))
End If
Else
'PURPOSE:When there is no more txtFind.Text,
' intPos will equal 0 - Exist this sub
Exit Sub
End If
Loop
End Sub
Chemically Formulated As:
Dr. Nitro
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|