N
Nikolay Petrov
When using StreamReader to read a text file I get some strange behavior
(strange only to me I guess ;-).
If file is saved from Notepad as Unicode the StreamReader works fine.
If file is saved as ANSI, the StreamReader don't read nothing.
Why and how to fix?
Here's my code:
==========
Private Function ReadTextFile(ByVal fName As String) As String
Dim filestream As StreamReader
filestream = File.OpenText(fname)
Dim Contents As String
Contents = filestream.ReadToEnd()
filestream.Close()
Return Contents
End Function
==========
(strange only to me I guess ;-).
If file is saved from Notepad as Unicode the StreamReader works fine.
If file is saved as ANSI, the StreamReader don't read nothing.
Why and how to fix?
Here's my code:
==========
Private Function ReadTextFile(ByVal fName As String) As String
Dim filestream As StreamReader
filestream = File.OpenText(fname)
Dim Contents As String
Contents = filestream.ReadToEnd()
filestream.Close()
Return Contents
End Function
==========