473,409 Members | 1,952 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,409 software developers and data experts.

noob: C# Config XML

Hi All I posted the below on MSDN and nothing so far so I hope someone here can help:

This is my first time working with XML so please bare with me

I have a form with 18 textboxes and i can save the textbox data to XML fine... I just cannot read it back and Load the settings to the correct textboxes:???

Write to XML by Using:

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
ItemInfo[] infos = new ItemInfo[this.Controls.Count];
for (int i = 0; i < this.Controls.Count; i++)
if (this.Controls[i] is TextBox)
{
infos[i] = ItemInfo.FromTB(this.Controls[i] as TextBox);
}

XmlConfigHelper.SetTBItems(infos);

//LoadSettings();
}

The result of the XML file is( short snippet)

<Settings>
<TextBoxes>
<Item>
<DisplayName>q6</DisplayName> <--TextBox name -->
<Location>319,108</Location> <--TextBox Location -->
<Value>234</Value> <--TextBox.Text Value-->
</Item>
</TextBoxes>
</Settings>

I have tried various methods to load this file and my last attempt is below: So any help with this is more than welcome before tall buildings become appealing ... ..thankyou in Advance...

private void LoadSettings()
{

ItemInfo[] infos = XmlConfigHelper.GetTBItems();//XmlConfigHelper = Get Set Class for XML creation

for (int i = 0; i < infos.Length; i++)
{

setTextBox(a[i], infos[i]);
}

}

void setTextBox(TextBox tb, ItemInfo info)
{
tb.Name = info.name; //this gives a null reference error????
tb.Location = info.TBLocation;
tb.Text = info.value;

}
Oct 6 '07 #1
1 1461
this is fixed now.... It needed a rethink and I compared the link below app methods against what i was trying to achieve:

http://www.codeproject.com/useritems...00&msg=2260292
Oct 7 '07 #2

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

Similar topics

7
by: administrata | last post by:
Is it possible? I tried... I = "John" print \ """ I used to love pizza"""
5
by: Tony Vasquez | last post by:
Hi fellas. I have a problem. I am trying ot get a popup window to appear in the center of the screen, both vertically and horozontally. I am trying to display a large version of an image in this...
8
by: Ivan Shevanski | last post by:
Alright heres another noob question for everyone. Alright, say I have a menu like this. print "1. . .Start" print "2. . .End" choice1 = raw_input("> ") and then I had this to determine what...
2
by: yerk5 | last post by:
This is my first day tinkering with php. I lifted a bunch of examples from the php.net manuals and put this together: http://abate.veritynet.net/~ddrguy/store.php It's extremely simple and just...
2
by: Link360 | last post by:
Im a complete noob and im proud of it. I am excited in learning everything about the C++ language. Right now im trying to make tic-tac-toe. Go ahead laugh. here is what i have so far ...
5
by: Hydrogenfussion | last post by:
Hello and thank you for reading this. I have just started to learn C++ from www.cprogramming.com,its a great site! But i do not understand some of the terms. I am using Dev-C++. Can you tell me...
2
by: kj | last post by:
I'm sure this is a simple, but recurrent, problem for which I can't hit on a totally satisfactory solution. As an example, suppose that I want write a module X that performs some database...
1
by: Fluffy654 | last post by:
First off I am a complete noob when it comes to doing anything with servers. I'm just beginning to learn today because I need to start adding SSI to my websites. I apologise in advance if I am making...
4
by: .nLL | last post by:
Hi, im am a classic asp developer and started to learn asp.net but got stuck with a simple problem even before i step in to further. to learn i have started from a simple project (a login system...
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...
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
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.