** I have a XML file in C:\sample project VB6\XMLFile1.xml but i dont know to fetch XML file in VB6, below i write a code in c# its executing **
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++; }
No comments:
Post a Comment