public void LoadTurn() { try { TurnBLL TurnBLL = new TurnBLL(); DataTable Turnos; Turnos = TurnBLL.All("All"); comboBoxTurno.DisplayMember = "Text"; comboBoxTurno.ValueMember = "Value"; List <Object> items = new List <object>(); items.Add(new { Text = "Todos", Value = "0" }); foreach (DataRow Turno in Turnos.Rows) { items.Add(new { Text = Turno[TurnML.DataBase.Name].ToString(), Value = Turno[TurnML.DataBase.Id].ToString() }); } comboBoxTurno.DataSource = items; } catch (Exception ex) { MessageBox.Show(String.Format("LoadTurn: {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadTurn() { try { TurnBLL TurnBLL = new TurnBLL(); int i = 1; int y = 10; Turns = TurnBLL.All("All"); checkedListBoxTurns.DisplayMember = "Text"; checkedListBoxTurns.ValueMember = "Value"; foreach (DataRow Turn in Turns.Rows) { checkedListBoxTurns.Items.Add(new { Text = Turn[TurnML.DataBase.Name].ToString(), Value = Turn[TurnML.DataBase.Id].ToString() }, false); TextBox _textbox = new TextBox { Name = i.ToString(), Text = Turn[TurnML.DataBase.HoursJornada].ToString(), Location = new Point(y, 311), Visible = true, Enabled = false }; y += 120; this.panel5.Controls.Add(_textbox); i += 1; //LoadTextHours(Turn[TurnML.DataBase.HoursJornada].ToString()); } } catch (Exception ex) { MessageBox.Show(String.Format("LoadTurn: {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }