示例#1
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int id = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Id"].Value);
         if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().ToLower() == "delete")
         {
             if (MessageBox.Show("Are you", "Delete", MessageBoxButtons.OKCancel) == DialogResult.OK)
             {
                 string   q  = "delete from batch where id=" + id;
                 Database db = new Database(q);
                 db.ExecuteNonQuery();
             }
         }
         else
         {
             NewBatch nb = new NewBatch(id);
             nb.myId = id;
             nb.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#2
0
        private void newBatchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewBatch nb = new NewBatch(0);

            nb.Show();
        }