private void grvData_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         string colName = grvData.Columns[e.ColumnIndex].Name;
         if (colName == "colSelect")
         {
             if (string.IsNullOrEmpty(_stockIn.txtRefNo.Text))
             {
                 MessageBox.Show("please enter reference no", _msg, MessageBoxButtons.OK, MessageBoxIcon.Warning); _stockIn.txtRefNo.Focus(); return;
             }
             if (string.IsNullOrEmpty(_stockIn.txtStockInBy.Text))
             {
                 MessageBox.Show("please enter stock In by", _msg, MessageBoxButtons.OK, MessageBoxIcon.Warning); _stockIn.txtStockInBy.Focus(); return;
             }
             var confirmResult = MessageBox.Show("Are you sure to add this item ??",
                                                 "Confirm add!!",
                                                 MessageBoxButtons.YesNo);
             if (confirmResult == DialogResult.Yes)
             {
                 using (SqlConnection sqlConnection = new SqlConnection(DBConnection.MyConnection()))
                 {
                     sqlConnection.Open();
                     string     query      = "insert into tblStockIn (refno,pcode,sdate,stockinby) values (@refno,@pcode,@sdate,@stockinby)";//select * from tblStockIn where pcode like '" + grvData.Rows[e.RowIndex].Cells[1].Value.ToString() +"'";
                     SqlCommand sqlCommand = new SqlCommand(query, sqlConnection);
                     sqlCommand.Parameters.AddWithValue("@refno", _stockIn.txtRefNo.Text);
                     sqlCommand.Parameters.AddWithValue("@pcode", grvData.Rows[e.RowIndex].Cells[1].Value.ToString());
                     sqlCommand.Parameters.AddWithValue("@sdate", _stockIn.dtpStockInDate.Value);
                     sqlCommand.Parameters.AddWithValue("@stockinby", _stockIn.txtStockInBy.Text);
                     sqlCommand.ExecuteNonQuery();
                     sqlConnection.Close();
                     MessageBox.Show("successfully added!", _msg, MessageBoxButtons.OK, MessageBoxIcon.Information);
                     _stockIn.LoadStockIn();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, _msg, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }