I am a .net beginner.
I am trying to update my xml file using linq.
I got stuck at the very first point of it i.e i cant grab the value from xml file using linq.
These are the controls I am using in my code:
cbBrandName -- combobox
cbProduct -- combobox
txtQuantity -- TextBox
I am trying the below code:
XElement doc = XElement.Load(@"..\..\stock.xml");
string quantity = doc.Descendants("quantity")
.Select(y => y.Element("quantity").Value.Equals(txtQuantity.Text))
/*red scribbles to 'Element' in 'where'*/
.Where(x => x.Element("productname").Value.Equals(cbProduct.Text) &&
x.Element("brandname").Value.Equals(cbBrandName.Text)).ToString();
MessageBox.Show(quantity.ToString());
here I am trying to store the "quantity" value in quantity string so that i can manipulate it later and then again update to my xml file.
when I make .select as comment it isn't showing any errors but when i run it, instead of text it is showing some system.linq.Enumerable + ..... in the MessageBox.
EDIT:

when i give .toString() at the end it. It is showing error -- "Object reference not set to an instance of an object." when i run it.
Please help
Thanks in Advance.