|
-
Nov 1st, 2004, 07:47 PM
#1
Thread Starter
Hyperactive Member
text file writing
how come this is not working?
Code:
Dim bookname As String = "\books.txt"
Dim objFileStream As New FileStream(Application.StartupPath & bookname, FileMode.Create, FileAccess.Write)
Dim Addbook As New StreamWriter(objFileStream)
txtName.Text = Names
txtAddress.Text = Address
Addbook.WriteLine(Names & Address)
Addbook.Close()
it creates the file, but does not write anything
-
Nov 1st, 2004, 08:01 PM
#2
Thread Starter
Hyperactive Member
nevermind. Got it.
Code:
Dim bookname As String = "\books.txt"
Dim objFileStream As New FileStream(Application.StartupPath & bookname, FileMode.Create, FileAccess.Write)
Dim Addbook As New StreamWriter(objFileStream)
Addbook.Write(txtName.Text)
Addbook.Close()
-
Nov 1st, 2004, 08:07 PM
#3
Addicted Member
txtName.Text = Names
txtAddress.Text = Address
Do you mean:
Names = txtName.Text
Address = txtAddress.Text
Or do you declare Names and Address somewhere else?
When I did this it worked perfectly:
Addbook.WriteLine(txtName.Text & txtAddress.Text)
By the way you probably want to put a & " " & or a & VBCrLf in there ...
-
Nov 1st, 2004, 10:33 PM
#4
Thread Starter
Hyperactive Member
curious as to what this means?
"VBCrLf"
-
Nov 1st, 2004, 10:36 PM
#5
Addicted Member
That's a constant, it adds a Carriage Return/Line Feed - starts a new line, in other words.
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
|