Beispiel #1
0
        private void buttonBrisanje_Click(object sender, EventArgs e)
        {
            DialogResult d = MessageBox.Show("Da li da sigurno želite da obrišete tip?", "Brisanje tipa", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (d.Equals(DialogResult.Yes))
            {
                String ID  = textBoxId.Text;
                Tip    tip = dajSelektovaniTip();

                DijalogZaBrisanje dzb = new DijalogZaBrisanje(main, tip);
                dzb.ShowDialog();

                //kad izbrise red iz tabele, ponovo je popuni
                main.refreshTree();
                dataGridViewTip.Rows.Clear();
                foreach (Tip t in tipovi)
                {
                    dataGridViewTip.Rows.Add(new object[] { t.ID, t.Ime, t.Opis });
                    dataGridViewTip.Rows[dataGridViewTip.Rows.Count - 1].Tag = t;
                }
                ucitavanje = false;
                if (tipovi.Count != 0)
                {
                    dataGridViewTip.CurrentCell = dataGridViewTip.Rows[0].Cells[0];
                    dataGridViewTip_SelectionChanged(dataGridViewTip, EventArgs.Empty);
                }
                else
                {
                    pictureBoxTip.BackgroundImage = null;
                    buttonDodavanje.Enabled       = true;
                    buttonIzmjena.Enabled         = false;
                    buttonBrisanje.Enabled        = false;
                }
            }
        }
Beispiel #2
0
        private void toolStripMenuItem5_Click(object sender, EventArgs e)
        {        //brisanje tipa
            TreeNode node = treeView1.SelectedNode;

            if (node.Tag is Tip)
            {
                Tip tip = (Tip)node.Tag;
                DijalogZaBrisanje dzb = new DijalogZaBrisanje(this, tip);
                dzb.ShowDialog();
                refreshTree();
            }
        }