Witam, chciałbym w swoim kodzie dodać sprawdzanie zawartości w pliku *.bin
Jeżeli w adresie &H10 jest wartość 26 to jest ok i program ma lecieć dalej
Jeżeli w adresie &H10 jest inna wartość niż 26 to chciałbym aby wyświetlał się msg box z napisem wrong file.
Tu jest mój kod, na razie niezależnie od wartości w &H10 zawsze wyświetla msgbox.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
Dim OFD As New OpenFileDialog
Dim fullFile() As Byte
With OFD
.Filter = "Binary files (*.bin)|*.bin"
End With
If OFD.ShowDialog = Windows.Forms.DialogResult.OK Then
fullFile = File.ReadAllBytes(OFD.FileName)
If fullFile(&H10) <> 26 Then
MsgBox("WRONG FILE")
End If
TextBox1.AppendText(fullFile(&H1E).ToString("X2") & " ")
TextBox1.AppendText(fullFile(&H1F).ToString("X2"))
End If
dodanie znacznika <code class="vbnet">
- @furious programming