private void newB_Click(object sender, EventArgs e) { newStitDialog dialog = new newStitDialog(); this.Hide(); if (dialog.ShowDialog(this) == DialogResult.OK) { listBox.Items.Add(dialog.jmeno); } this.Show(); }
private void editB_Click(object sender, EventArgs e) { if (Program.getDB().stity.FindByjmeno(listBox.Text) == null) { MessageBox.Show("Pro úpravu musíte vybrat štít ze seznamu.", "Vyberte štít", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } newStitDialog dialog = new newStitDialog(listBox.Text); this.Hide(); if (dialog.ShowDialog(this) == DialogResult.OK) { listBox.Items.Insert(listBox.Items.IndexOf(dialog.edit), dialog.jmeno); listBox.Items.RemoveAt(listBox.Items.IndexOf(dialog.edit)); } this.Show(); }