I am reading data from a text file into a text box. When the data comes up it reads a b c d e f g (with a CarriageReturn symbol between each letter) In the text file the letters are on different lines. Any help would be great.
Printable View
I am reading data from a text file into a text box. When the data comes up it reads a b c d e f g (with a CarriageReturn symbol between each letter) In the text file the letters are on different lines. Any help would be great.
If you don't want to ahve CRLF in your string you have to look for
Chr(13) & Chr(10)
and make a Filter
CU
Kreuzfeld
?
It's not that I dont want the CRLF. I want the action of CRLF not the CRLF character.
for i=1 to StringLength do
if (string(i) <> Chr(13)) OR (string(i) <> Chr(10)) then
NewString = NewString & string(i)
end if
next i
try this
maybe it works :-)
dim s as string
open filename "c:\temp.txt" for input as #1
do until EOF(1)
input #1, s
textbox = textbox & s
loop
close #1
i think this is what you are asking for.
you might need to add microsoft scripting runtime as a refernce as well.
Nick
I tried this, but it still returning the CrLf symbol and not performing the CrLf action.
Code:Dim s As String
Dim fn As Integer
fn = FreeFile
Open strName For Input As #fn
Do Until EOF(1)
txtContents = Input(LOF(fn), #fn) & s
Loop
Close #fn
have you got the text box set to multiline?
if so, just check all the chars in the string for vbcrlf. If you find one, replace it with a space, and start a new line in the textbox.
Nick
MultiLine, why didn't I think of that. This has been killing me. Thanks, that was it. The easy answer. :)