void CargarLista() { try { NAsignatura n = new NAsignatura(); List <EAsignatura> l = n.ListaAsignatura(); dataGridView1.DataSource = l; dataGridView1.Columns[0].Visible = false; for (int i = 0; i < dataGridView1.RowCount; i++) { if (Convert.ToBoolean(dataGridView1.Rows[i].Cells["Activo"].Value.ToString()) == false) { dataGridView1.Rows[i].DefaultCellStyle.ForeColor = Color.Red; } else { dataGridView1.Rows[i].DefaultCellStyle.ForeColor = Color.Black; } } } catch (Exception ex) { throw ex; } }
void CargarAsignaturas() { try { NAsignatura n = new NAsignatura(); List <EAsignatura> listaAsignatura = n.ListaAsignatura(); listBox1.DataSource = listaAsignatura; listBox1.DisplayMember = "Asignatura"; listBox1.ValueMember = "AsignaturaId"; } catch (Exception ex) { throw ex; } }
void CargarAsignatura() { try { NAsignatura n = new NAsignatura(); List <EAsignatura> Lista = n.ListaAsignatura(); var NuevaLista = (from i in Lista select new { i.AsignaturaId, i.Asignatura }).ToList(); listBox1.DataSource = NuevaLista; listBox1.DisplayMember = "Asignatura"; listBox1.ValueMember = "AsignaturaId"; } catch (Exception ex) { throw ex; } }