Question Hex file into vb to edit then save

Super_hoops1967

New member
Joined
Jun 18, 2012
Messages
4
Programming Experience
Beginner
Hi

I want to make a program where I load in a file in hex format and have a number of check boxes where if selected then certain hex values change.

So it would search for offset d5dc and change the last 4 values to 00 E1 F5 05 and then then same again for other check boxes with different offsets set to each one.

Is this an impossible task?

Thanks for any help
 
Here's how you can simply display the contents of a file in hexadecimal format in a TextBox:
myTextBox.Text = String.Join(" ", IO.File.ReadAllBytes(filePath).Select(Function(b) b.ToString("X2")))
Now, that example requires .NET 4.0 and, therefore, VB 2010. If that's not an option then you can get the same result fairly easily but with slightly more code.
 
I've got visual studio 2010 installed (the free one from ms) so that should be fine I think.

Thank you so much for your help I'll give it a go today at work :eagerness:
 
Assuming that the contents is valid, the reverse step would be:
IO.File.WriteAllBytes(filePath, myTextBox.Text.Split(" "c).Select(Function(s) Convert.ToByte(s, 16)).ToArray())
 
Back
Top