OK hello im only 17 and im learning Vb on my own, i have a project onwhich i have to create. but of course theres an issue.
I have the coding
dim studentname as string
open "C:\test1.text" for output as #1
studentname= text1.text
print #1, studentname
close #1
if i type my name (Jordan) into the text1.text it creates the file like its saposed to, BUT if i type John into it , it erases Jordan and only puts John in there! I need to know how to add multiple things to the file without erasing the existing information.
PLz help me
[VBcode]
SubLife_Load()
If Age>25
Unload me
end if
sub end
[/vbcode]
Originally posted by n00b1337
OK hello im only 17 and im learning Vb on my own, i have a project onwhich i have to create. but of course theres an issue.
I have the coding
dim studentname as string
open "C:\test1.text" for append as #1
studentname= text1.text
print #1, studentname
close #1
if i type my name (Jordan) into the text1.text it creates the file like its saposed to, BUT if i type John into it , it erases Jordan and only puts John in there! I need to know how to add multiple things to the file without erasing the existing information.
PLz help me
i put in what u wrote and its still not working , lemme explain what i want it to do alittle better... i want it to write the names to that file now that it is created, but whenever it writes to it , it erases what was in the folder in the first place. (this is a new question) how would i get the program to check and see if the username is in that file??
[VBcode]
SubLife_Load()
If Age>25
Unload me
end if
sub end
[/vbcode]
I don't know what you want, but the code does what you asked for.
If you run the supplied code, it will add new entries to the "C:\Test1.text" or "C:\test1.txt" file.
You attempted to explain, but you are talking appending to a file, and then you switch to a folder.
If Peet hasn't answered your question, please try and explain again, cause I don't understand.
ok im sorry for not being descriptive enough, im still n00b. but i tried the append and it didnt do anything, i checked C:\Test.txt and it didnt change it, it still only says jordan, im sorry if im not explaining enough im trying i think its messing up becuase im telling it to create again, so it might just be over writing the original.
[VBcode]
SubLife_Load()
If Age>25
Unload me
end if
sub end
[/vbcode]
ok im sorry for not being descriptive enough, im still n00b. but i tried the append and it didnt do anything, i checked C:\Test.txt and it didnt change it, it still only says jordan, im sorry if im not explaining enough im trying i think its messing up becuase im telling it to create again, so it might just be over writing the original.
Your code in your first post says C:\Test1.text
Your code in the above quote says C:\Test.txt
Check that your looking at the same file your writing to. JPicasso is right if you used append exactly as he showed then it worked.
What event are you using to run this code?( command button click etc...)
Post your entire code there may be a problem somewhere else.
JO
"I have not failed. I've just found 10,000 ways that won't work."
'Thomas Edison'
"If we knew what it was we were doing it wouldn't be called research, would it?"
'Albert Einstein'