[RESOLVED] How to add a name to a textfile??
Hello, me again :wave:
I have a textfile (c:\data.txt) with a lot of names in it.
Jack
Bruce
Roger
and so on..
All these names are loaded in a ListBox (List1) on Form Load.
I also have a TextBox (txtName) so people can add names to it. When clicking on "Command1" the new name will first be added to the textfile (c:\data.txt) and then it will be added to the ListBox (List1)
The problem is that the new name thats saved to the textfile (c:\data.txt) is added like this:
Jack
Bruce
RogerNew name
I want the new name being added like this:
Jack
Bruce
Roger
New name
The code i use for saving the new name to the textfile (c:\names.txt) is this:
'Add new name to textfile
Open App.Path & "\names.txt" For Append As #1
Print #1, txtName.Text;
Close #1
Can someone tell me what im doing wrong?
Thanks,
Warad
Re: How to add a name to a textfile??
The problem is the semi-colon at the end of the Print line, which is used to say "don't move to the next line".
The code will work as you want if you simply remove it, eg:
Code:
Print #1, txtName.Text
Re: How to add a name to a textfile??
Thanks geek,
That solved the problem.
Warad