private void Button4_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1 || listBox2.SelectedIndex != -1) { try { if (listBox1.SelectedIndex != -1) { UjElelmiszerForm dialogus = new UjElelmiszerForm((Elelmiszer)listBox1.SelectedItem, true); dialogus.ShowDialog(); } else { UjElelmiszerForm dialogus = new UjElelmiszerForm((Elelmiszer)listBox2.SelectedItem, true); dialogus.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("For display choose a food!", "Attention!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void Button5_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1 || listBox2.SelectedIndex != -1) { try { if (listBox1.SelectedIndex != -1) { UjElelmiszerForm dialogus = new UjElelmiszerForm((Elelmiszer)listBox1.SelectedItem); if (dialogus.ShowDialog() == DialogResult.OK) { listBoxRefresh(); } } else { UjElelmiszerForm dialogus = new UjElelmiszerForm((Elelmiszer)listBox2.SelectedItem); if (dialogus.ShowDialog() == DialogResult.OK) { listBoxRefresh(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("For modification choose a food!", "Attention!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void Button3_Click(object sender, EventArgs e) { try { UjElelmiszerForm dialogus = new UjElelmiszerForm(); if (dialogus.ShowDialog() == DialogResult.OK) { listBoxRefresh(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }