all groups > vb.net upgrade > december 2005 >
You're in the

vb.net upgrade

group:

reading and writing a file in VB


reading and writing a file in VB Athono
12/28/2005 8:11:35 PM
vb.net upgrade:
Has anyone had any experience reading and writing a file in VB?

When I write a string variable to a file it puts quotes around the line.

THen when I read it back, the quotes are there. How do I strip the quotes or
Re: reading and writing a file in VB Homer J Simpson
1/1/2006 7:44:23 PM

[quoted text, click to view]

Sample code?

[quoted text, click to view]


Re: reading and writing a file in VB Cindy Winegarden
1/2/2006 9:51:27 AM
Hi Athono,

I have no problems with the following code. As Homer said, what code are you
using?

Dim text1 As New String("This is my test string.")
Dim writer1 As New
System.IO.StreamWriter("C:\Temp\TestWriter1.txt")
writer1.Write(text1)
writer1.Close()

Dim reader1 As New
System.IO.StreamReader("C:\Temp\TestWriter1.txt")
Dim text2 As String = reader1.ReadToEnd()
reader1.Close()

Dim writer2 As New
System.IO.StreamWriter("C:\Temp\TestWriter2.txt")
writer2.Write(text2)
writer2.Close()

Dim reader3 As New
System.IO.StreamReader("C:\Temp\TestWriter2.txt")
Dim text3 As String = reader3.ReadToEnd()
reader3.Close()

Stop ' to check the values

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy_winegarden@msn.com www.cindywinegarden.com


[quoted text, click to view]

AddThis Social Bookmark Button