This question is related to my previous question where I got answer to use LINQ which I cant understand. Is there any other way to do this without using LINQ? (I know LINQ is best, but not good to start with by beginners i think)
I want to populate a combobox based on the previous combobox selection (cbProduct and cbBrandName)
Both comboboxes have values from same XML file.
Before asking here I have gone through many links but there answer is mostly based on LINQ or it is not related to xml.
I tried the below code: (it just assigns values)
DataSet dsBill = new DataSet();
dsBill.ReadXml(@"..\..\stock.xml");
/*ERROR*/ cbProduct.DataSource = dsBill.Tables[0].DefaultView.ToTable(true, "productname");
cbProduct.DisplayMember = "productname";
One more question, this code was working when i have not assigned name attribute to xml file and now it is showing Error — “Column ‘productname’ does not belong to underlying table ‘items’.“
Please help
Thanks in Advance.
Regarding the question about adding the
nameattribute, I think that you just didn’t update your code to support that. Try this: