private void btnUnos_Click(object sender, EventArgs e)
        {
            string dir = @"D:\Documents\xmlDokument";

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            Ucenik ucenik = new Ucenik(textBoxIme.Text, textBoxPrezime.Text, textBoxEmail.Text, comboBoxRazred.SelectedItem.ToString());

            listaUcenik.Add(ucenik);
        }
Ejemplo n.º 2
0
        private void btnFiltriraj_Click(object sender, EventArgs e)
        {
            FormaFiltriraj frm = new FormaFiltriraj();

            frm.Show();
            XElement povuciPodatke         = XElement.Load(@"D:/Documents/xmlDokument/pretraga12.xml");
            IEnumerable <XElement> ucenici = from Ucenik in povuciPodatke.Descendants("Ucenik")
                                             where (string)Ucenik.Element("Ime") == FormaFiltriraj.Ime &&
                                             (string)Ucenik.Element("Prezime") == FormaFiltriraj.Prezime &&
                                             (string)Ucenik.Element("EmailAdresa") == FormaFiltriraj.Email &&
                                             (string)Ucenik.Element("Razred") == FormaFiltriraj.Razred
                                             select Ucenik;

            foreach (var item in ucenici)
            {
                richTextBoxUcitaj.Text += item.ToString() + " \n";
            }
        }