extra character in text file?

bensonwalker
bensonwalker used Ask the Experts™
on
I'm using Visual Studio 2010 (VB) and using this code to create a csv file:

Dim MyCSVWriter = My.Computer.FileSystem.OpenTextFileWriter(MyFileName, True)

MyCSVWriter = My.Computer.FileSystem.OpenTextFileWriter(MyFileName, True)

MyCSVWriter.WriteLine(MyText1)

MyCSVWriter.Close()


The file that I create seems to have hidden characters. I can copy and paste the text from the file into a different text file and I'm able to use it, but the file left as is does not process.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
GrahamSkanRetired
Top Expert 2012

Commented:
Don't forget that lines have to be terminated somehow, usually by a carriage return character and a line feed character. If this doesn't explain it, what makes you think that the file has hidden characters?
Commented:
try
Using MyCSVWriter As New StreamWriter("MyFileName", True)
    MyCSVWriter.WriteLine("MyText")
End Using

Open in new window

kaufmedGlanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
Side comment:  Any reason why you are opening the file twice?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial