public frmCon_GrupoEmpresarial_plancta() { InitializeComponent(); try { ct_GrupoEmpresarial_grupocble_Bus _GrupoCbleB = new ct_GrupoEmpresarial_grupocble_Bus(); cmb_grupocbtle.DataSource = _GrupoCbleB.Get_list_GrupoEmpresarial_grupocble(); cmb_grupocbtle.DisplayMember = "gc_GrupoCble_gr"; cmb_grupocbtle.ValueMember = "IdGrupoCble_gr"; LstNivelCta = NivelCta_bus.Get_list_GrupoEmpresarial_plancta_nivel(); if (LstNivelCta == null || LstNivelCta.Count() == 0) { MessageBox.Show("No puede continuar, antes debe ingresar los Nivele del plan de Cuenta , Falta ingresar los Niveles del Plan de Cuenta.. \nIngréselos desde la pantalla de parámetros de Contabilidad,o comuníquese con sistemas", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error); //this.Parent.Dispose(); } if (LstNivelCta.Count() > 0) { PrimerNivel = LstNivelCta.Select(y => y.IdNivelCta_gr).Min(); // LstNivelCta.Where(c => c.Estado == "A").Select(y => y.IdNivelCta).Min(); ultimoNivel = LstNivelCta.Select(y => y.IdNivelCta_gr).Max(); lblnivelcuenta.Text = Convert.ToString(PrimerNivel); var xd = LstNivelCta.Where(c => c.IdNivelCta_gr == PrimerNivel).Select(y => y.nv_NumDigitos_gr).First(); txt_id.MaxLength = (xd == null) ? 1 : Convert.ToInt32(xd); cmb_naturaleza.SelectedIndex = 0; listaPlan = PlanCta_B.Get_list_GrupoEmpresarial_plancta(); //menos los que son ultimo nivel listaPlan cmbPlancta.Properties.DataSource = listaPlan.FindAll(v => v.IdNivelCta_gr != ultimoNivel); cmbPlancta.Properties.DisplayMember = "pc_Cuenta_gr"; cmbPlancta.Properties.ValueMember = "IdCuenta_gr"; } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }