private void BtnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult opcion;
                opcion = MessageBox.Show("Se eliminarĂ¡n el(las) Tarea(s) asociado(s) a esta funcion, realmente deseas eliminar el(los) registro(s) ? ", "Control de Tareas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (opcion == DialogResult.OK)
                {
                    int    codigo;
                    string Rpta = "";

                    codigo = Convert.ToInt32(DgvListado.CurrentRow.Cells[3].Value.ToString());
                    Rpta   = NFuncion.Eliminar(codigo);

                    if (Rpta.Equals("OK"))
                    {
                        this.MensajeOk("Se elimino el registro: " + Convert.ToString(DgvListado.CurrentRow.Cells[3].Value));
                    }
                    else
                    {
                        this.MensajeError(Rpta);
                    }
                    this.Listar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
        private void DgvListado_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == DgvListado.Columns["Seleccionar"].Index)
            {
                DataGridViewCheckBoxCell Chkeliminar = (DataGridViewCheckBoxCell)DgvListado.Rows[e.RowIndex].Cells["Seleccionar"];
                Chkeliminar.Value = !Convert.ToBoolean(Chkeliminar.Value);
            }

            //Cell content click para el icono de eliminar
            if (e.ColumnIndex == DgvListado.Columns["Eliminar"].Index)
            {
                try
                {
                    DialogResult opcion;
                    opcion = MessageBox.Show("Se eliminarĂ¡n el(las) Tarea(s) asociado(s) a esta funcion, realmente deseas eliminar el(los) registro(s) ? ", "Control de Tareas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (opcion == DialogResult.OK)
                    {
                        int    codigo;
                        string Rpta = "";

                        codigo = Convert.ToInt32(DgvListado.CurrentRow.Cells[3].Value.ToString());
                        Rpta   = NFuncion.Eliminar(codigo);

                        if (Rpta.Equals("OK"))
                        {
                            this.MensajeOk("Se elimino el registro: " + Convert.ToString(DgvListado.CurrentRow.Cells[3].Value));
                        }
                        else
                        {
                            this.MensajeError(Rpta);
                        }
                        this.Listar();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ex.StackTrace);
                }
            }

            //Cell Content Click para el icono de editar
            if (e.ColumnIndex == DgvListado.Columns["Editar"].Index)
            {
                this.Limpiar();
                BtnActualizar.Visible    = true;
                BtnInsertar.Visible      = false;
                TxtId.Text               = Convert.ToString(DgvListado.CurrentRow.Cells["id_funcion"].Value);
                this.DescAnterior        = Convert.ToString(DgvListado.CurrentRow.Cells["descripcion"].Value);
                TxtDescripcion.Text      = Convert.ToString(DgvListado.CurrentRow.Cells["descripcion"].Value);
                DtpFechaTermino.Text     = Convert.ToString(DgvListado.CurrentRow.Cells["fecha_termino"].Value);
                CboDepto.Text            = Convert.ToString(DgvListado.CurrentRow.Cells["nombre_depto"].Value);
                TabGeneral.SelectedIndex = 1;
            }
        }