日期:2014-05-17 浏览次数:21083 次
//从xml文件中绑定控件
private void update1()
{
DataSet ds = new DataSet();
string fromPath = System.Environment.CurrentDirectory + @"\conf\rate_group.xml";
FileInfo xmlFile = new FileInfo(fromPath);
if (xmlFile.Exists)
{
FileStream fsReadxml = new FileStream(fromPath, FileMode.Open);
XmlTextReader myXmlReader = new XmlTextReader(fsReadxml);
ds.ReadXml(myXmlReader);
myXmlReader.Close();
}
comboBoxEx41.DataSource = ds.Tables[0];
comboBoxEx41.DisplayMember = "displaymember";
comboBoxEx41.ValueMember = "valuemember";
comboBoxEx41.SelectedIndex = -1;
comboBoxEx41.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxEx42.DataSource = ds.Tables[0];
comboBoxEx42.DisplayMember = "displaymember";
comboBoxEx42.ValueMember = "valuemember";
comboBoxEx42.SelectedIndex = -1;
comboBoxEx42.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxEx43.DataSource = ds.Tables[0];
comboBoxEx43.DisplayMember = "displaymember";
comboBoxEx43.ValueMember = "valuemember";
comboBoxEx43.SelectedIndex = -1;
comboBoxEx43.DropDownStyle = ComboBoxStyle.DropDow