pashi

pashi

  • NA
  • 17
  • 0

: cannot convert from 'string[]' to 'string' what is this error abt?

Mar 7 2007 8:56 AM
Hi i sorry, if any big blunders i am very new to this kind of programming plese help me actually i have collected some values from xml file and i need to disply them so i wrote public string[] GetLaserProp(string laserid, string parentnode1, string childnode1) { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(@"E:\Dropdown_XML\laserProp.xml"); string[] str = new string[5]; // XmlNodeList xmlnodelst = xmldoc.GetElementsByTagName("laser"); XmlNodeList xmlnodelst = xmldoc.GetElementsByTagName(parentnode1); //return xmlnodelst; //foreach (XmlNode.parentnode in xmlnodelst) foreach (XmlNode parentnode in xmlnodelst) { //MessageBox.Show(parentnode.Attributes.Item(0).Value); if (parentnode.Attributes.Item(0).Value == laserid) { xmldoc.LoadXml(parentnode.InnerXml); //XmlNodeList xmlchildnodelst=xmldoc.GetElementsByTagName("gauge"); XmlNodeList xmlchildnodelst = xmldoc.GetElementsByTagName(childnode1); // cmbChildLaser.Items.Clear(); foreach (XmlNode childnode in xmlchildnodelst) { for (int i = 0; i < childnode.ChildNodes.Count; i++) { //cmbChildLaser.Items.Add(childnode.ChildNodes.Item(i).Attributes.Item(0).Value); for (int j = 0; j < childnode.ChildNodes.Item(i).Attributes.Count; j++) { // MessageBox.Show( str[j]= childnode.ChildNodes.Item(i).Attributes.Item(j).Value; //cmbChildLaser.Items.Add(xmlnodelst1.Item(ii).ChildNodes.Item(0).InnerText); return str; } } } } } //return (Student []) students.ToArray();} return str;

Answers (1)