private void btnAdd_Click(object sender, EventArgs e)
        {
            frmProduct product = new frmProduct(this);

            product.btnSave.Enabled   = true;
            product.btnUpdate.Enabled = false;
            product.LoadBrand();
            product.LoadCategory();
            product.ShowDialog();
        }
 private void grvData_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         string colName = grvData.Columns[e.ColumnIndex].Name;
         if (colName == "Edit")
         {
             frmProduct frmProduct = new frmProduct(this);
             frmProduct.btnSave.Enabled     = false;
             frmProduct.btnUpdate.Enabled   = true;
             frmProduct.txtProductCode.Text = grvData.Rows[e.RowIndex].Cells[1].Value.ToString();
             frmProduct.txtBarcode.Text     = grvData.Rows[e.RowIndex].Cells[2].Value.ToString();
             frmProduct.txtDescription.Text = grvData.Rows[e.RowIndex].Cells[3].Value.ToString();
             frmProduct.txtPrice.Text       = grvData.Rows[e.RowIndex].Cells[6].Value.ToString();
             frmProduct.cmbBrand.Text       = grvData.Rows[e.RowIndex].Cells[4].Value.ToString();
             frmProduct.cmbCategory.Text    = grvData.Rows[e.RowIndex].Cells[5].Value.ToString();
             // frmProduct.txtInitialQty.Text= grvData.Rows[e.RowIndex].Cells[5].Value.ToString();
             frmProduct.ShowDialog();
         }
         else
         {
             var confirmResult = MessageBox.Show("Are you sure to delete this item ??",
                                                 "Confirm Delete!!",
                                                 MessageBoxButtons.YesNo);
             if (confirmResult == DialogResult.Yes)
             {
                 using (SqlConnection sqlConnection = new SqlConnection(DBConnection.MyConnection()))
                 {
                     sqlConnection.Open();
                     string     query      = "delete from tblProduct where pcode like '" + grvData.Rows[e.RowIndex].Cells[1].Value.ToString() + "'";
                     SqlCommand sqlCommand = new SqlCommand(query, sqlConnection);
                     sqlCommand.ExecuteNonQuery();
                     sqlConnection.Close();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Product List", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }