Solved

Problem with Readline in VB.Net

Posted on 2007-03-26
5
1,295 Views
Last Modified: 2013-11-26
I want to read a textfile in VB.Net using the commando readline:
Dim fileinput = New StreamReader("C:\Front_End\Upload\filiaal_0002.all", System.Text.Encoding.UTF8)
sline = fileinput.readline
This statement omit several charaters (for instance ", ')

How can i read and write this special characters??
0
Comment
Question by:Tilbu_Soft
  • 3
  • 2
5 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 18799792
Hi Tilbu_Soft;

The stream reader should be able to read those characters already. Can we see a sample of the file that you are having problems with?

Fernando
0
 

Author Comment

by:Tilbu_Soft
ID: 18801750
Here is a sample of the file:
AR060230PLPlatinum 450/M + 15“moniIN3016788820070327016788820070327701020         HAWA12J   0137178        NJN 20070327 0167888  0000000                                                             T

Position 30 = omitted    Value = Hex 93    
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 250 total points
ID: 18802628
hI Tilbu_Soft;

I am sorry, by the looks of the characters posted in the question, (for instance ", '), they looked like a double quote comma an a single quote. The encoding of the text is in your data is found on Code Page 1252. The below code should work. or you can use the System.Text.Encoding.Default in place of System.Text.Encoding.GetEncoding("windows-1252") but it is safer to use the one shown below.

        Dim fileinput As New StreamReader("C:\Front_End\Upload\filiaal_0002.all", System.Text.Encoding.GetEncoding("windows-1252"))
        Dim sline As String = fileinput.ReadLine
        fileinput.Close()


Fernando
0
 

Author Comment

by:Tilbu_Soft
ID: 18806195
This is the solution.....thank you

0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 18807749
Not a problem, glad I was able to help. ;=)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Batch file or script with password 22 65
location of a form 2 25
parsing JSON help 1 20
reading excel file in .net 2 14
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question