I wrote this code and I think there is an easier way to do it that may work, but I just don't know how. I tried changing the code for about 3 hours and I'm getting no where. The TextBox won't update when I'm reading a byte that would convert it to a string; it only works if I put only one "if statement" with the correct byte that translates it into a string. I'm doing this for a couple of other addresses in the file and I also shortened the code to put up on here as an example of what I'm trying to do. hope you guys can help me out.
Private Sub OpenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OpenToolStripMenuItem.Click
OpenFileDialog1.ShowDialog()
Dim fileName As String = OpenFileDialog1.FileName
Dim fileStream As IO.FileStream = New IO.FileStream(fileName, IO.FileMode.Open)
Dim br As New BinaryReader(fileStream)
fileStream.Position = 2348
If br.ReadByte = 76 Then
TextBox1.Text += " "
ElseIf br.ReadByte = 175 Then
TextBox1.Text += "."
ElseIf br.ReadByte = 186 Then
TextBox1.Text += "A"
End If
fileStream.Close()
br.Close()
End Sub
Aucun commentaire:
Enregistrer un commentaire