473,403 Members | 2,293 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,403 software developers and data experts.

Binary File IO

A C# program that I am currently working on contains about 100
textBoxes, 5 pictureBoxes, 20+ radioButtons ect.

Concern / Question 1 (Save File)
In the past when writing code to save the currently opened file, I would
create about 125+ variables to save the text, images and radioButton
checkstate to disk. These same variables would be used to load
everything back into their correct control when the file was re-opened.
Does anyone know if there is a faster / better way to accomplish the
same thing ?

Concern / Question 2 (Close File)
When a user clicks on the 'Close File' menu option in the above program,
code is used to clear / re-set all user data from the controls. The
user's screen looks the same as when it was first opened... but, all the
program variables used to store data and perform the necessary
calculations still contain their data. How can I clear them or at least
make sure that they do not cause problems when the user begins to enter
new data and tries t o perform a new set of calculations.

Any help would be appreciated.

bernden

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
4 2073
Hi,

Concern / Question 1 (Save File)
In the past when writing code to save the currently opened file, I would
create about 125+ variables to save the text, images and radioButton
checkstate to disk. These same variables would be used to load
everything back into their correct control when the file was re-opened.
Does anyone know if there is a faster / better way to accomplish the
same thing ?
Why you create so many variables?
You can iterate in the controls and get theirs properties (the one you are
going to store) directly from them, no need to create new variables

Are the number of controls constant? if so you know beforehand how many you
need to read from the file, otherwise yuo need to store this info too in the
file

The
user's screen looks the same as when it was first opened... but, all the
program variables used to store data and perform the necessary
calculations still contain their data. How can I clear them or at least
make sure that they do not cause problems when the user begins to enter
new data and tries t o perform a new set of calculations.


You need to store somewhere the seeds , any value you are going to use in
the calculations that will not vary.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Nov 17 '05 #2
Create a class object to store the different settings for your form. Create
methods to "bind" the data to the form, and then another to "bind" the input
values to the class object. Serialize/Deserialize the class object to save
the headache of doing it manually (also less error prone, it seems to me).

I'll let someone else inform you that that many controls on a form is
probably a bad idea, difficult design, etc. Someone else might propose a
"wizard" or something.

Scott
"bernden" <be*****@devdex.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
A C# program that I am currently working on contains about 100
textBoxes, 5 pictureBoxes, 20+ radioButtons ect.

Concern / Question 1 (Save File)
In the past when writing code to save the currently opened file, I would
create about 125+ variables to save the text, images and radioButton
checkstate to disk. These same variables would be used to load
everything back into their correct control when the file was re-opened.
Does anyone know if there is a faster / better way to accomplish the
same thing ?

Concern / Question 2 (Close File)
When a user clicks on the 'Close File' menu option in the above program,
code is used to clear / re-set all user data from the controls. The
user's screen looks the same as when it was first opened... but, all the
program variables used to store data and perform the necessary
calculations still contain their data. How can I clear them or at least
make sure that they do not cause problems when the user begins to enter
new data and tries t o perform a new set of calculations.

Any help would be appreciated.

bernden

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #3
Thank you for the reply.

My experience with iteration is limited to counting, enabling and
clearing controls. I have never tried to iterate thru the controls on a
Form and get the properties of just the ones that need to be stored.

Is there a site that provides a tutorial on how to accomplish this ?

bernden
*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #4
Problem Solved !

Thanks to information and tutorials provided by the following site I was
able to understand how to solve the problem.

http://www.functionx.com/csharp

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: yaipa | last post by:
What would be the common sense way of finding a binary pattern in a ..bin file, say some 200 bytes, and replacing it with an updated pattern of the same length at the same offset? Also, the...
28
by: wwj | last post by:
void main() { char* p="Hello"; printf("%s",p); *p='w'; printf("%s",p); }
9
by: Ching-Lung | last post by:
Hi all, I try to create a tool to check the delta (diff) of 2 binaries and create the delta binary. I use binary formatter (serialization) to create the delta binary. It works fine but the...
3
by: John R. Delaney | last post by:
I am running in debugging mode after a clean C++ compilation under .NET 2003. In a BIG loop (controlled many levels up in the call stack), I open a file with fopen using the "a" option. Then I write...
5
by: Neo | last post by:
Hello: I am receiving a Binary File in a Request from a application. The stream which comes to me has the boundary (Something like "---------------------------39<WBR>­0C0F3E0099" without the...
12
by: Adam J. Schaff | last post by:
I am writing a quick program to edit a binary file that contains file paths (amongst other things). If I look at the files in notepad, they look like: ...
7
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should...
68
by: vim | last post by:
hello everybody Plz tell the differance between binary file and ascii file............... Thanks in advance vim
10
by: rory | last post by:
I can't seem to append a string to the end of a binary file. I'm using the following code: fstream outFile("test.exe", ios::in | ios::out | ios::binary | ios::ate | ios::app)...
16
by: Erwin Moller | last post by:
Why is a binary file executable? Is any binary file executable? Is only binary file executable? Are all executable files binary? What is the connection between the attribute of binary and that of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.