|
-
Jun 30th, 2006, 02:06 PM
#1
Thread Starter
Frenzied Member
very odd problem with file print
In a module I have
In Form1 on form_load I have
VB Code:
fileff = FreeFile
Open "C:blah.txt" For Append As #fileff
Then in module1, when i do something like
Print #fileff, "hello"
Print #fileff, "there"
it appears in the file as:
hello
there
shouldn't it be: hellothere (this is how i want it)
-
Jun 30th, 2006, 02:16 PM
#2
Lively Member
Re: very odd problem with file print
Ever time you use the Print#....
It'll create a new line.
You would need to say
Code:
Print #fileff, "hello" & "there"
Or
Print #fileff, "hellothere"
Hope that helps
-
Jun 30th, 2006, 02:18 PM
#3
Addicted Member
Re: very odd problem with file print
Another way to do this is as follows:
Print #fileff, "hello"; ' Note the semi-colon which supresses the CRLF at line end
Print #fileff, "there"
-
Jun 30th, 2006, 02:20 PM
#4
Thread Starter
Frenzied Member
Re: very odd problem with file print
but i want everything to appear on 1 line so if i do
Print #fileff, "HelloThere"
Print #fileff, "some more!!"
etc etc..
the file would be like this:
HelloTheresome more!!
is this not possible?
-
Jun 30th, 2006, 02:20 PM
#5
Lively Member
Re: very odd problem with file print
No, I think it is the same as with printing to the form. Every time you write print it will make a new line, if you add ; it should print to the same line. Alternatively you could print "hello" & "there", but I have a feeling you are in a loop with variables to print so that might not be the best solution. So all in all, I believe (don't have vb6 here at the moment" that if you write
VB Code:
Print #ffile; "Hello";
Print #ffile; "There"
It should work.
Edit: wow in the time it took to write that there was a lot of posts...
-
Jun 30th, 2006, 02:20 PM
#6
Thread Starter
Frenzied Member
Re: very odd problem with file print
ahhhh, sigid, awesome!!
thats exactly what I needed!!!
Thanks mate
Edit* and John hehe i cant believe the ';' makes such a big diff for me!
-
Jun 30th, 2006, 02:21 PM
#7
Addicted Member
Re: very odd problem with file print
Of course:
Print #fileff, "HelloThere"; ' Again, the semi colon is important!
Print #fileff, "some more!!"
will result in the file containing "HelloTheresome more!!"
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
|