combobox绑定xml数据源

string xmlpath = path + "\list.xml";
 DataSet xmlds = new DataSet();
 xmlds.ReadXml(xmlpath);
 playlist.DataSource = xmlds.Tables["list"];
 playlist.DisplayMember = "mname";
 playlist.ValueMember = "murl";

xml文件

<list>
  <list name="test">
    <mname>test</mname>
    <murl>http://www.ciphp.com</murl>
  </list>
</list>

发表评论

电子邮件地址不会被公开。 必填项已用*标注