System.IO.StreamReader is not returning single quotes from my file

  • Thread starter Nathan Sokalski
  • Start date
N

Nathan Sokalski

I am using a System.IO.StreamReader to read a text file that was created
with Notepad. It is returning everything except the single quotes (at least
that is the only thing I have noticed it is not returning). The code I am
using is:

Dim poemstreamreader As System.IO.StreamReader

poemstreamreader = System.IO.File.OpenText(Global.Poems(poemtitle))

cellPoemText.Text = poemstreamreader.ReadToEnd()

poemstreamreader.Close()


I know that it is reading from the correct file, because it is returning all
the characters correctly, I simply need to know how to make it not discard
special characters such as single quotes. How do I do this? Thanks.
 
C

Cor Ligthert

Nathan,

You mean something as
cellPoemText.Text = poemstreamreader.ReadToEnd()
poemstreamreader.Close()

cellPoemText.Text = cellPoemText.Text.Replace("'","")

I hope this helps,

Cor
 
A

Armin Zingler

Nathan Sokalski said:
I am using a System.IO.StreamReader to read a text file that was
created with Notepad. It is returning everything except the single quotes
(at
least that is the only thing I have noticed it is not returning).
The code I am using is:

Dim poemstreamreader As System.IO.StreamReader

poemstreamreader =
System.IO.File.OpenText(Global.Poems(poemtitle))
cellPoemText.Text = poemstreamreader.ReadToEnd()

poemstreamreader.Close()


I know that it is reading from the correct file, because it is
returning all the characters correctly, I simply need to know how to
make it not discard special characters such as single quotes. How do
I do this?


Don't know if this helps:

poemstreamreader = new io.streamreader(Global.Poems(poemtitle),
system.text.encoding.default)

This assumes ANSI encoding of the file.


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top