|
-
Aug 21st, 2001, 04:42 AM
#1
Thread Starter
Lively Member
Import data from text file
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.
-
Aug 21st, 2001, 04:52 AM
#2
Addicted Member
Make your own Filter
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
-
Aug 21st, 2001, 04:53 AM
#3
Thread Starter
Lively Member
-
Aug 21st, 2001, 04:55 AM
#4
Thread Starter
Lively Member
It's not that I dont want the CRLF. I want the action of CRLF not the CRLF character.
-
Aug 21st, 2001, 04:56 AM
#5
Addicted Member
like this
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 :-)
-
Aug 21st, 2001, 04:59 AM
#6
Fanatic Member
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
-
Aug 21st, 2001, 05:26 AM
#7
Thread Starter
Lively Member
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
-
Aug 21st, 2001, 05:38 AM
#8
Fanatic Member
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
-
Aug 21st, 2001, 05:48 AM
#9
Thread Starter
Lively Member
MultiLine, why didn't I think of that. This has been killing me. Thanks, that was it. The easy answer.
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
|