Solved

Edit byte in file

Posted on 2010-11-23
4
295 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 250 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

724 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