?
Solved

Edit byte in file

Posted on 2010-11-23
4
Medium Priority
?
298 Views
Last Modified: 2012-05-10
So I have no problem reading the byte in this file I want, but I'm having difficulty editing it with VB.NET.

(For example) The value is 0B in hex and I have a combobox populate with possible replacements for the byte - say 9.  They are in decimal format and I want them to be able to be selected, then switched to hex format and replace the byte that I have already previously read.  So in this instance, 0B becomes 09 after 9 is selected in the combobox and a button is pushed.

Do I need to read the byte first to know which one to replace?

Any help is appreciated!
0
Comment
Question by:jasgiv1122
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 1000 total points
ID: 34200566
You can use either BitConverter Class ToString() method or X2 hexadecimal format specifier.

BitConverter Class
http://msdn.microsoft.com/en-us/library/system.bitconverter.aspx
Debug.Print(CByte(ComboBox1.SelectedItem).ToString("X2"))

Open in new window

0
 
LVL 2

Author Comment

by:jasgiv1122
ID: 34200632
How can I determine where in the file it puts the formatted number?  I need to read the first byte in the file and replace it with my newly formatted text.

Thanks
0
 
LVL 2

Assisted Solution

by:jasgiv1122
jasgiv1122 earned 0 total points
ID: 34201332
I figured the rest out. Thanks
0
 
LVL 2

Author Closing Comment

by:jasgiv1122
ID: 34224727
Answered half of my question.  I used Writebyte to solve the rest of my problem.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question