473,382 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to write the contents of a textbox to a hex file

I have managed to make my program read and display my selected hex line as below:
Expand|Select|Wrap|Line Numbers
  1.                 BinaryReader br = new BinaryReader(File.OpenRead(ofd.FileName));
  2.                 string speed = null;
  3.                 for (int i = 0x83; i <= 0x8f; i++)
  4.                 {
  5.                     br.BaseStream.Position = i;
  6.                     speed += br.ReadByte().ToString("X2");
  7.                 }
  8.                 br.Close();
  9.  
  10.  
  11.                 textBox1.Text = (speed);
  12.  
This will display what i need to know in my textbox e.g. "153f4e6a"


but if i need to change whats in the textbox to e.g. "153ee563". I don't know how to write it back to the file i know its wrong but i thought something like this.
Expand|Select|Wrap|Line Numbers
  1.                 BinaryWriter bw = new BinaryWriter(File.OpenWrite(ofd.FileName));
  2.                 for (int i = 0x83; i <= 0x8f; i++)
  3.                 {
  4.                     bw.BaseStream.Position = i;
  5.                     bw.Write (0xTextbox1.text );
  6.                 }
  7.                 bw.Close();
  8.  
But i don't know the correct way of doing it even tho it could be really easy
Jan 29 '14 #1
0 1099

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Amy G | last post by:
I am looking to make this code a little "nicer"... any suggestions??? I want to do a "read+" where I would be able to first read the contents of the file... then either close the file out or write...
5
by: rxl124 | last post by:
Hi, quick question, how would you assign a contents to file in perl i was thinking $filename=`echo newvalue > filename`;
11
by: Frank B. | last post by:
Is there anyway to write a folders contents to file? -Frank B.
2
by: Rich | last post by:
Hello, I have a winform app that end users in my company use for various operations - mainly searching stuff. It is a VB2005 app. People enter parameters and want to be able to recall what...
13
Deathwing
by: Deathwing | last post by:
Hello, I'm fairly new to python and have only been playing around with it for one week actually. It's my first attempt at programming and I'm trying to generate some random floats and then...
5
by: JonathanB | last post by:
Ok, so this is the scenario. I need to create a simple, no-frills XML editor for non-technical users. It doesn't have to do anything fancy, what I want is a series of text boxes with the text...
0
by: sandhyamn | last post by:
hi....i am writing a jsp code for uploading file inside a folder using multipart/form-data.but also i want to write textbox values in to that file, but the textbox values is not coming. ie..textbox...
1
by: sandhyamn | last post by:
hi...i am trying to write a programme for uploading file with jsp using multipart/form data.it's working.....but the problem is i can't write the textbox values into a file....if change the form...
13
by: zach | last post by:
Can someone help me out, I can't figure out what I'm doing wrong to write to a file in binary mode. What's wrong with my code? <?php $fileName = "something.dat"; $string = "This is a...
2
by: DR | last post by:
how to search tfs by name of file or contents in file?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.