1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| public class ComboBoxItem
{
public string Value;
public string Text;
public ComboBoxItem(string val, string text)
{
Value = val;
Text = text;
}
public override string ToString()
{
return Text;
}
}
var db = new DataClasses2DataContext();
// collone 1
var md1 = (from m in db.Conditions
where m.Collone == 1
select new { m.Condition1,m.Id });
foreach (var m in md1)
{
comboBoxCondition11.Items.Add(new ComboBoxItem(m.Id.ToString(),m.Condition1));
comboBoxCondition21.Items.Add(new ComboBoxItem(m.Id.ToString(), m.Condition1));
comboBoxCondition11.ValueMember = m.Id.ToString();
} |
Partager