Public Function FillData(ByVal Fpath As String) As Boolean Dim XRead As System.IO.StreamReader = New IO.StreamReader(FilePath) Dim XLine As String = Nothing Dim XSplitLine() As String Dim i As Integer = ImportedData.Rows.Count + 1 Try XRead.ReadLine() XLine = XRead.ReadLine() Do Until XLine Is Nothing XLine = i & vbTab & XLine & vbTab & FilePath XSplitLine = XLine.Split(CType(vbTab, Char())) ImportedData.Rows.Add(XSplitLine) XLine = XRead.ReadLine i += 1 Loop XRead.Close() Catch ex As Exception MessageBox.Show("Error") Return False Exit Function End Try Return True End Function
Quote:Different computers can use different encodings as the default, and the default encoding can change on a single computer. If you use the Default encoding to encode and decode data streamed between computers or retrieved at different times on the same computer, it may translate that data incorrectly. In addition, the encoding returned by the Default property uses best-fit fallback to map unsupported characters to characters supported by the code page. For these reasons, using the default encoding is not recommended. To ensure that encoded bytes are decoded properly, you should use a Unicode encoding, such as UTF8Encoding or UnicodeEncoding. You could also use a higher-level protocol to ensure that the same format is used for encoding and decoding.
Dim XRead As System.IO.StreamReader = New IO.StreamReader(FilePath, System.Text.Encoding.UnicodeEncoding)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)