private void button2_Click(object sender, EventArgs e) { if (ListView1.Items.Count == 0) { MessageBox.Show("Please select record to update", "Add Stocks", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } try { if (ListView1.FocusedItem != null) { if (string.IsNullOrEmpty(ListView1.FocusedItem.Text)) { } else { SQLConn.adding = false; SQLConn.updating = true; staffID = Convert.ToInt32(ListView1.FocusedItem.Text); frmAddEditStaff f2 = new frmAddEditStaff(staffID); f2.ShowDialog(); } } } catch { MessageBox.Show("Please select record to update", "Add Stocks", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }
private void button1_Click(object sender, EventArgs e) { SQLConn.adding = true; SQLConn.updating = false; int init = 0; frmAddEditStaff f2 = new frmAddEditStaff(init); f2.ShowDialog(); }