Solved

Problem with Readline in VB.Net

Posted on 2007-03-26
5
1,287 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 62

Expert Comment

by:Fernando Soto
Comment Utility
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
Comment Utility
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 62

Accepted Solution

by:
Fernando Soto earned 250 total points
Comment Utility
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
Comment Utility
This is the solution.....thank you

0
 
LVL 62

Expert Comment

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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now