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)
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
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"
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?
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...
Re: very odd problem with file print
ahhhh, sigid, awesome!!
thats exactly what I needed!!!
Thanks mate
Edit* and John :p hehe i cant believe the ';' makes such a big diff for me!
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!!"