Hi All... 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:???
Code Block
Write to XML by Using:
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);
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...
Code Block
private void LoadSettings()
{
ItemInfo[] infos = XmlConfigHelper.GetTBItems();
for (int i = 0; i < infos.Length; i++)
{
setTextBox(a[i], infos[i]); //a = textbox array
}
}
void setTextBox(TextBox tb, ItemInfo info)
{
tb.Name = info.name; //returns null reference exception??????
tb.Location = info.TBLocation;
tb.Text = info.value;
}