private void btn_addItem_Click(object sender, EventArgs e) { using (ItemED item = new ItemED()) { if (item.ShowDialog() != DialogResult.Cancel) { txt_search.Clear(); btn_clear.Hide(); items = new Items(); LoadItems(items.getItems()); } } }
private void dgv_items_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex > -1) { string item_id = dgv_items.Rows[e.RowIndex].Cells["id"].Value.ToString(); using (ItemED item = new ItemED(item_id)) { if (item.ShowDialog() != DialogResult.Cancel) { txt_search.Clear(); btn_clear.Hide(); items = new Items(); LoadItems(items.getItems()); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }