Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

read text file in vb.net compact framework

124 views
Skip to first unread message

Daniele Martignago

unread,
May 6, 2003, 11:56:33 AM5/6/03
to
Hi,
I'm new with .net and CF.
I use Microsoft Smart Device Extensions for Visual Studio .NET Version
7.00.2098.
I build a text file on my Pc using Notepad and then copied to the device.
I am trying to read the text file with this code:

Dim path as String = "\temp\my test.txt"
Try

Dim sr as StreamReader = New StreaReader(path,
System.Text.Encoding.ASCII)
Dim strLine as String

strLine = sr.Readline

Do While (Not strLine is Nothing)
MessageBox.Show(strLine)
strLine = sr.ReadLine
Loop

Catch e As Exception
MessageBox.Show ("Error: ", e.toString())
End Try


My problem is this: when I read lines the messagebox show strange text like
"\}qoklmngh{oklmnops{|}.."

Any Idea? Need some conversion?
Thanks all.
--
Martignago Daniele

Alex Feinman

unread,
May 6, 2003, 12:32:18 PM5/6/03
to
On Windows CE devices text files are typically unicode. In your code try
replacing Encoding.ASCII with Encoding.Unicode or just omit this parameter -
the default is Unicode and would work

"Daniele Martignago" <marti...@ergon.it> wrote in message
news:eeBERi%23EDH...@TK2MSFTNGP12.phx.gbl...

Eric de carufel

unread,
May 14, 2003, 11:12:47 AM5/14/03
to
Hi there,
We are experiencing the same problem under C#.
Does the Visual Studio 2003 developement suite solves the
problem ?

You are not alone :(

>.
>

Ginny Caughey [MVP]

unread,
May 14, 2003, 11:28:53 AM5/14/03
to
Eric,

How do you know that the text file is ASCII? Look at it with a hex editor.
--
Ginny Caughey
Windows Embedded MVP

"Eric de carufel" <eric.de...@imagina.ca> wrote in message
news:0fe201c31a2b$46edeea0$3101...@phx.gbl...

0 new messages