Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write Text to file

Status
Not open for further replies.

newmem

Programmer
Jul 23, 2002
35
0
0
US
Hi,

Its probably a very dumb question but I am stuck.

- I have a vb.net code which writes text to a file on the local machine. The file write has been done sucessfully but being a string data, its writing " (double quotes) in the final string. The file needs to contain only text without any quotes. How can I get away with it?

here's my code :

dim sFileName as string = "testFile.dat"
Dim iFileNum As Integer
iFileNum = FreeFile()
FileOpen(iFileNum, sFileName, OpenMode.Append)

Dim sLine As String
Dim sEmpNum As String
Dim sYear As String = Year(Now)
Dim sMonth As String = Month(Now)
Dim sDay As String = Day(Now)
Dim sHour As String = Hour(Now)
Dim sMinute As String = Minute(Now)

'Build the final string
sLine = sEmpNum & sYear & sMonth & sDay & sHour & sMinute

WriteLine(iFileNum, sLine)

'close the file
FileClose(iFileNum)

=========
The file should have data like:
0000002438200210141042
0000002439200210141042
0000002440200210141042

 
WriteLine(iFileNum, sLine.replace("""",string.empty))
penny1.gif
penny1.gif
 
thanks.

But the file still shows up:
"0000002438200210141042"

instead it shud be
0000002438200210141042

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top