private void BtnEditar_Click(object sender, EventArgs e)
 {
     if (dgvContactos.SelectedCells.Count > 0)
     {
         foreach (Form item in Application.OpenForms)
         {
             if (item.GetType() == typeof(Contacto))
             {
                 item.Focus();
                 return;
             }
         }
         try
         {
             Contacto    obj = (Contacto)dgvContactos.CurrentRow.DataBoundItem;
             ModContacto mod = new ModContacto(obj);
             mod.ShowDialog();
             LlenarTabla();
         }
         catch (Exception ex)
         {
             Mensaje m = new Mensaje(ex.ToString()); m.ShowDialog();
         }
     }
     else
     {
         Mensaje m = new Mensaje("Ningun item seleccionado.");
         m.ShowDialog();
     }
 }
 private void BtnAgregar_Click(object sender, EventArgs e)
 {
     foreach (Form item in Application.OpenForms)
     {
         if (item.GetType() == typeof(ModContacto))
         {
             item.Focus();
             return;
         }
     }
     try
     {
         ModContacto mod = new ModContacto(IdRelacion);
         mod.ShowDialog();
         LlenarTabla();
     }
     catch (Exception ex)
     {
         Mensaje m = new Mensaje(ex.ToString()); m.ShowDialog();
     }
 }