<?xml version="1.0" encoding="utf-8"?> <Students> <!-- student1 details --> <StudentDetails> <ID>1</ID> <FirstName>Anand</FirstName> <Age>20</Age> <Mark1>90</Mark1> <Mark2>90</Mark2> <Mark3>90</Mark3> <Mark4>90</Mark4> <Mark5>90</Mark5> <Total>450</Total> <Avg>90</Avg> </StudentDetails> <!-- student2 details --> <StudentDetails> <ID>2</ID> <FirstName>bala</FirstName> <Age>20</Age> <Mark1>90</Mark1> <Mark2>90</Mark2> <Mark3>90</Mark3> <Mark4>90</Mark4> <Mark5>90</Mark5> <Total>450</Total> <Avg>90</Avg> </StudentDetails> <!-- student3 details --> <StudentDetails> <ID>3</ID> <FirstName>Banu</FirstName> <Age>20</Age> <Mark1>90</Mark1> <Mark2>90</Mark2> <Mark3>90</Mark3> <Mark4>90</Mark4> <Mark5>90</Mark5> <Total>450</Total> <Avg>90</Avg> </StudentDetails> <!-- student4 details --> <StudentDetails> <ID>4</ID> <FirstName>chitra</FirstName> <Age>20</Age> <Mark1>90</Mark1> <Mark2>90</Mark2> <Mark3>90</Mark3> <Mark4>90</Mark4> <Mark5>90</Mark5> <Total>450</Total> <Avg>90</Avg> </StudentDetails> <!-- student5 details --> <StudentDetails> <ID>5</ID> <FirstName>saranya</FirstName> <Age>20</Age> <Mark1>90</Mark1> <Mark2>90</Mark2> <Mark3>90</Mark3> <Mark4>90</Mark4> <Mark5>90</Mark5> <Total>450</Total> <Avg>90</Avg> </StudentDetails> <!-- student6 details --> <StudentDetails> <ID>6</ID> <FirstName>prasanth</FirstName> <Age>20</Age> <Mark1>90</Mark1> <Mark2>90</Mark2> <Mark3>90</Mark3> <Mark4>90</Mark4> <Mark5>90</Mark5> <Total>450</Total> <Avg>90</Avg> </StudentDetails> <!-- student7 details --> <StudentDetails> <ID>7</ID> <FirstName>suresh</FirstName> <Age>20</Age> <Mark1>90</Mark1> <Mark2>90</Mark2> <Mark3>90</Mark3> <Mark4>90</Mark4> <Mark5>90</Mark5> <Total>450</Total> <Avg>90</Avg> </StudentDetails> <!-- student8 details --> <StudentDetails> <ID>8</ID> <FirstName>nandhini</FirstName> <Age>20</Age> <Mark1>90</Mark1> <Mark2>90</Mark2> <Mark3>90</Mark3> <Mark4>90</Mark4> <Mark5>90</Mark5> <Total>450</Total> <Avg>90</Avg> </StudentDetails> <!-- student9 details --> <StudentDetails> <ID>9</ID> <FirstName>keerthi</FirstName> <Age>20</Age> <Mark1>90</Mark1> <Mark2>90</Mark2> <Mark3>90</Mark3> <Mark4>90</Mark4> <Mark5>90</Mark5> <Total>450</Total> <Avg>90</Avg> </StudentDetails> <!-- student10 details --> <StudentDetails> <ID>10</ID> <FirstName>vinu</FirstName> <Age>20</Age> <Mark1>90</Mark1> <Mark2>90</Mark2> <Mark3>90</Mark3> <Mark4>90</Mark4> <Mark5>90</Mark5> <Total>450</Total> <Avg>90</Avg> </StudentDetails> </Students>
using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Xml; using System.IO; using System.Configuration; using System.Reflection; namespace Axml1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { XmlDocument doc = new XmlDocument(); doc.Load("C:\\New Folder\\student.xml"); XmlNodeList list = doc.SelectNodes("/Students/StudentDetails"); foreach (XmlNode xn in list) { string ID = xn["ID"].InnerText; lbID.Items.Add(ID); } } private void lbID_SelectedIndexChanged(object sender, EventArgs e) { XmlDocument doc = new XmlDocument(); doc.Load("C:\\New Folder\\student.xml"); string rollno = lbID.Text; XmlNodeList xnList = doc.SelectNodes("/Students/StudentDetails"); foreach (XmlNode xn1 in xnList) { string rollNumber = xn1["ID"].InnerText; string Name = xn1["FirstName"].InnerText; string Age = xn1["Age"].InnerText; string Mark1 = xn1["Mark1"].InnerText; string Mark2 = xn1["Mark2"].InnerText; string Mark3 = xn1["Mark3"].InnerText; string Mark4 = xn1["Mark4"].InnerText; string Mark5 = xn1["Mark5"].InnerText; string Total = xn1["Total"].InnerText; string Avg = xn1["Avg"].InnerText; if (rollno == rollNumber) { txtName.Text = Name; txtAge.Text = Age; txtMark1.Text = Mark1; txtMark2.Text = Mark2; txtMark3.Text = Mark3; txtMark4.Text = Mark4; txtMark5.Text = Mark5; txtTotal.Text = Total; txtAvg.Text = Avg; break; } } } } }
System.Reflection.Assembly.GetEntryAssembly().Location
System.Environment.SpecialFolder.LocalApplicationData
System.Environment.GetFolderPath(SpecialFolder)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)