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
Solved

Edit byte in file

Posted on 2010-11-23
4
290 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
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

860 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