No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
3 Posted Topics
通过下面的方法你可能从提供的xml文件中,提取出所有id的value; I hope it is useful to you . [code=C#] XmlDocument xmldoc = new XmlDocument(); StreamReader sr = new StreamReader("../../XMLTest.xml"); XmlReader xmlrd=XmlReader.Create(sr); //xmldoc.LoadXml(); xmldoc.Load(xmlrd); XmlNodeList nodes= xmldoc.SelectNodes("locs/loc"); foreach (XmlNode node in nodes) { string str1= node.Attributes["id"].Value; comboBox1.Items.Add(str1); } [/code]
hope it is useful to you [code=c#] string[] lines = { "a", "b","c"}; string tmp = "pre_a"; System.Collections.ArrayList arrls = new System.Collections.ArrayList(); arrls.AddRange(lines); arrls.Insert(0, tmp); Object[] newLines = arrls.ToArray(); foreach (string a in newLines) { listBox1.Items.Add(a); } [/code]
The End.
weigp