473,466 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can an in-memory DataTable be used as a data source for controls?

This is something of a design question.

I have WinForms app that requires persisting a bunch of user settings. The
app maintains a number of "Projects" that contain a variety of parameters,
many of which are Array objects.

Can I store all these things in a DataTable and just serialize/deserialize
the DataTable to XML when the app starts?

What is the best way to persist user settings?

More about the app:

Projects are scheduled to run at user-defined intervals. The app has a
windows service (starts at boot) that maintains a number of TimeSpan objects
(one for each Project) which are independent from the app's UI. When a
project's TimeSpan object counts down to zero, a Project object is
instantiated and it's methods are run.

When the app's GUI is opened, the service's TimeSpan objects need to be
available to client objects in the WinForms app, and displayed in the UI.
This allows a real-time countdown to be displayed.

Would a DataTable be the best way to persist all the various properties that
comprise the Project objects? And then just bind all the UI controls to the
DataTable so the user can adjust them, then serialize the DataTable to an
XML file when the GUI is closed?

Thanks in advance.

Feb 20 '06 #1
2 1236
Deko,
I am not sure that a DataTable is "the best way", but it certainly is an
easy way. Just make sure that you add the table to a new DataSet so that you
can call the WriteXml method to persist it. Same with ReadXml and then
retrieve your DataTable from the DataSet.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"deko" wrote:
This is something of a design question.

I have WinForms app that requires persisting a bunch of user settings. The
app maintains a number of "Projects" that contain a variety of parameters,
many of which are Array objects.

Can I store all these things in a DataTable and just serialize/deserialize
the DataTable to XML when the app starts?

What is the best way to persist user settings?

More about the app:

Projects are scheduled to run at user-defined intervals. The app has a
windows service (starts at boot) that maintains a number of TimeSpan objects
(one for each Project) which are independent from the app's UI. When a
project's TimeSpan object counts down to zero, a Project object is
instantiated and it's methods are run.

When the app's GUI is opened, the service's TimeSpan objects need to be
available to client objects in the WinForms app, and displayed in the UI.
This allows a real-time countdown to be displayed.

Would a DataTable be the best way to persist all the various properties that
comprise the Project objects? And then just bind all the UI controls to the
DataTable so the user can adjust them, then serialize the DataTable to an
XML file when the GUI is closed?

Thanks in advance.

Feb 20 '06 #2
> I am not sure that a DataTable is "the best way", but it certainly is an
easy way. Just make sure that you add the table to a new DataSet so that
you
can call the WriteXml method to persist it. Same with ReadXml and then
retrieve your DataTable from the DataSet.


Thanks for the comments. I think a DataTable is the way to go. Mainly
because my data is relational and also because it offers scalability (if I
ever want to use a database back end). As for "best way" - that's a moving
target, as you suggested.

I've been reading about .NET 2.0's new ApplicationSettingsBase class. It
sounds great for some things, like UI preferences, but not the kind of
relational data I have to work with. But I'll find some way to use it -
like whether or not there's a systray icon, logging preferences, stuff like
that.

Feb 20 '06 #3

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

Similar topics

3
by: Curious Expatriate | last post by:
Hi- I'm completely stumped. I'm trying to write some code that will parse a file and rewrite it with all URLs replaced by something else. For example: if the file looks like this: <b>click...
1
by: JS Bangs | last post by:
I started using PHP's object-oriented stuff a little while ago, which has mostly been a joy. However, I've noticed that they don't seem to echo as I would like. Eg: $this->field = 255;...
5
by: lawrence | last post by:
I've waited 6 weeks for an answer to my other question and still no luck, so let me rephrase the question. I know I can do this: <form method="post" action="$self"> <input type="text"...
2
by: Felix | last post by:
Hi, I've a problem: I want to have the result of my Mysql Query in a Table in my php file. Now I've this: <?
1
by: James | last post by:
What is the best way to update a record in a MYSQL DB using a FORM and PHP ? Where ID = $ID ! Any examples or URLS ? Thanks
1
by: Patrick Schlaepfer | last post by:
Why this code is not working on Solaris 2.8 host. Always getting: PHP Fatal error: swfaction() : getURL('http://www.php.net' ^ Line 1: Reason: 'syntax error' in /.../htdocs/ming2.php on...
1
by: lawrence | last post by:
What is the PHP equivalent of messaging, as in Java?
3
by: Quinten Carlson | last post by:
Is there a way to conditionally define a function in php? I'm trying to run a php page 10 times using the include statement, but I get an error because my function is already defined. The docs...
10
by: lawrence | last post by:
I get the impression that most people who are using objects in their PHP projects are mixing them with procedural code. The design, I think, is one where the procedural code is the client code, and...
2
by: Phillip Wu | last post by:
Hi, I saw a previous post about sending arrays but did not quite understand the answers. The problem is that I would like to pass an entire array as a hidden input field from one php script...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.