Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim OFD As New OpenFileDialog
Try
OFD.Filter = "Binary files (*.bin)|*.bin"
If OFD.ShowDialog = Windows.Forms.DialogResult.OK Then
fullFile = File.ReadAllBytes(OFD.FileName)
Dim writer As New BinaryWriter(OFD.OpenFile)
writer.Seek(&H5B0, SeekOrigin.Begin)
writer.Write(CUShort(&HB1AA))
writer.Close()
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Error")
End Try
It should open file and then change bytes into it. But while open file I got message box with:
Error Can't write in stream
And file is still not changed. Fix my code.