How can I insert products into combo box by loading form

aeyvetara

New Member
I am new to C# and I have one problem With XML file. My code is below\[code\] <root><product category="Soaps"> <product type="Washing"></product> <product type="Bathing"></product></product><product category="ThoothPaste"> <product type="ThoothPaste"></product></product><product category="Biscuits"> <product type="Parle"></product> <product type="Marrie"></product> <product type="Britania"></product></product> </root> \[/code\]I want when I load the form, product type attributes should be inserted into my combobox. I tried the blow code but I did not get expected result. Can any one provide solution?\[code\] private void Admin_Load(object sender, EventArgs e) { DataSet ds = new DataSet(); ds.ReadXml(strpath + "Products.xml"); dgvProducts.DataSource = ds.Tables[0]; xdoc.Load(strpath + "list.xml"); // MessageBox.Show("Test231"); XmlNodeList nodeList = xdoc.SelectNodes("//product"); // MessageBox.Show("Test"); foreach (XmlNodeList node in nodeList) { cmbBox.Items.Add(node.innerText) } }\[/code\]
 
Back
Top