im using the ReadLine command to read text hawever it is not reading characters corectly.
For example it reads "Ðeãdßáñg" as "edg". skipping the Ð, ã, and ßáñ characters.
One person suggests that I use streamreader to open the text as a binary array. How would I do this? What code should I add?
How can I resolve this problem?
here is a copy of my code:
Code:Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click Dim myString As String Dim input As String Dim iCount As Integer Dim theFile As FileInfo Dim re As StreamReader Dim time As Object Label2.Text = TimeOfDay 'Open the file to a stream theFile = New FileInfo("C:\Program Files\Novalogic\Delta Force Land Warrior\scores.txt") re = theFile.OpenText() 'Read in the first line input = re.ReadLine 'Loop through each line Do iCount = iCount + 1 'This will let the first four lines go, then 'it will add the rest of the file to myString. If iCount > 4 Then 'You can put a return character inbetween these two if you 'want to have a new line for each line added. myString = myString & vbCrLf & input & " " & Now RichTextBox1.Text = myString.ToString() End If 'Read in the next line for the loop. input = re.ReadLine. If input = "" Then iCount = -1 End If Loop Until input = "End" Dim fs As FileStream Dim sw As StreamWriter fs = New FileStream("c:\DoneStats.txt", FileMode.Append) sw = New StreamWriter(fs) Dim itm As Object For Each itm In RichTextBox1.Text sw.Write(itm) re.Close() Next re.Close() sw.Close() fs.Close() Dim fs2 As FileStream Dim sw2 As StreamWriter fs2 = New FileStream("C:\Program Files\Novalogic\Delta Force Land Warrior\scores.txt", FileMode.Create) sw2 = New StreamWriter(fs2) End Sub




Reply With Quote