public void carga() { dtUsuarios.Rows.Clear(); Models.Users usuario = new Models.Users(); using (usuario) { List <Models.Users> usuarios = usuario.getUsers(); if (usuarios.Count > 0) { foreach (Models.Users item in usuarios) { dtUsuarios.Rows.Add(item.Id, item.Nombre, item.User, item.Tipo); } } } }
private void Promotor_Load(object sender, EventArgs e) { Finicial.Format = DateTimePickerFormat.Custom; Finicial.CustomFormat = "yyyy-MM-dd"; Ffinal.Format = DateTimePickerFormat.Custom; Ffinal.CustomFormat = "yyyy-MM-dd"; DataTable table = new DataTable(); DataRow row; table.Columns.Add("Text", typeof(string)); table.Columns.Add("Value", typeof(string)); row = table.NewRow(); row["Text"] = ""; row["Value"] = ""; table.Rows.Add(row); // cboMarca.Items.Clear(); Models.Users usuarios = new Models.Users(); using (usuarios) { List <Models.Users> result = usuarios.getUsers(); foreach (Models.Users item in result) { row = table.NewRow(); row["Text"] = item.Nombre; row["Value"] = item.Id; table.Rows.Add(row); } } cbPromotor.BindingContext = new BindingContext(); cbPromotor.DataSource = table; cbPromotor.DisplayMember = "Text"; cbPromotor.ValueMember = "Value"; cbPromotor.BindingContext = new BindingContext(); }