I've wrote some code with a xml databinding. On one machine with win7 32 bit it works perfectly, but on another with win7 64 bit not.
using System.Windows.Forms;
using System.Xml;
namespace DataBindingDemo {
public partial class Form1 : Form {
string xmlPath = Properties.Settings.Default.XmlPath;
XmlDocument doc;
public Form1() {
InitializeComponent();
this.doc = new XmlDocument();
this.doc.Load(xmlPath);
XmlNodeList list = this.doc.GetElementsByTagName("test");
XmlNode node1 = list[0];
XmlNode node2 = list[1];
Binding binding1 = new Binding("Text", node1, "InnerText");
this.textBox1.DataBindings.Add(binding1);
Binding binding2 = new Binding("Text", node2, "InnerText");
this.textBox2.DataBindings.Add(binding2);
this.FormClosed += new FormClosedEventHandler(Form1_FormClosed);
}
void Form1_FormClosed(object sender, FormClosedEventArgs e) {
this.doc.Save(xmlPath);
}
}
}
Why?
No comments:
Post a Comment