Hi i want to read xml..
i have two combo boxes one is showing Prgorrames Name and 2nd will show Semester No with respected to Programme..

For example if I select Programme BBa so another combobox will show all the semesters of BBa...and when i select semester 5 so data of BBA 5 semester must be show in datagrid..
i m doing but i m not able to do it..
thats my code

 private void Form2_Load(object sender, EventArgs e)
        {
            ds = new DataSet();
            ds.ReadXml("D:\\student.xml");


            for (int i = 0; i < ds.Tables[0].Rows.Count; i++ )
            {
                string n = ds.Tables[0].Rows[i].ItemArray[3].ToString();
                cbProgramme.Items.Add(n);
            }
        }

        private void cbSelect_SelectedIndexChanged(object sender, EventArgs e)
        {
            dv = new DataView();
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++ )
            {
                string n2 = ds.Tables[0].Rows[i].ItemArray[0].ToString();
                cbSemNo.Items.Add(cbProgramme.Items[3]);
            }
         }

hope some one will solve it..
Regards...
Farhad

Edited 3 Years Ago by Nick Evan: Fixed formatting

// set xml structure as such <Semester><Value Name="Semester1"/><Value Name="Semester2"/></Semester>etc.etc.
System.Xml.XmlDocument doc = new Sytem.Xml.XmlDocument();
doc.Load("Path to Xml File");
foreach (XmlNode node in doc.SelectNodes("/Semester/Value"))
{
combox1.Items.Add(node.Attributes["Name"].innerText);
}

Edited 5 Years Ago by CsharpChico: n/a

This article has been dead for over six months. Start a new discussion instead.