**我在C:\ sample项目VB6 \ XMLFile1.xml中有一个XML文件,但我不知道在VB6中获取XML文件,下面我在c#中编写一个代码来执行**
private void Form1_Load(object sender, EventArgs e)
{
// this code is for keypress event handler
string path;
path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
myxml.Load(@"" + path + "/samplexml.xml");
XmlNode first = myxml.SelectSingleNode("students/student");
name.Text = first.SelectSingleNode("s_name").InnerText;
age.Text = first.Attributes["s_age"].Value;
gender.Text = myxml.SelectSingleNode("students/student/s_gender").InnerText;
addres.Text = myxml.SelectSingleNode("students/student/s_addres").InnerText;
phone.Text = myxml.SelectSingleNode("students/student/s_phone").InnerText;
previus.Visible = false;
//this code take all the nodelist to the collection list
items = new List<XmlNode>();
XmlNodeList xy = myxml.SelectNodes("students/student");
foreach (XmlNode item in xy)
{
items.Add(item);
size++;
}