Solved

Edit byte in file

Posted on 2010-11-23
4
285 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
  • 3
4 Comments
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
I figured the rest out. Thanks
0
 
LVL 2

Author Closing Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now