public ViewForm(RedComboBox[] comboboxes, RedContext context) { InitializeComponent(); dataGridView1.AutoGenerateColumns = false; parametrs = new List<string>(); InitGrid(comboboxes, context); }
private void InitGrid(RedComboBox[] comboboxes, RedContext context) { foreach(RedComboBox cb in comboboxes) { var row = new DataGridViewRow(); var c1 = new DataGridViewTextBoxCell(); c1.Value = cb.Name; DataGridViewCell c2; if (cb.query.ToLowerInvariant() == "textedit") { c2 = new DataGridViewTextBoxCell(); c2.Value = ""; } else { c2 = new DataGridViewComboBoxCell(); var t = cb.GetValues(context); foreach (DataRow r in t.Rows) { (c2 as DataGridViewComboBoxCell).Items.Add(r[0].ToString()); } (c2 as DataGridViewComboBoxCell).Value = (c2 as DataGridViewComboBoxCell).Items[0]; } c2.ReadOnly = false; row.Cells.Add(c1); row.Cells.Add(c2); dataGridView1.Rows.Add(row); } }
public void AddComboBox(string name, RedComboBox comboBox)//addcheckboxhere! { ComboBoxes.Add(name, comboBox); }
//addcheckboxhere! public void AddComboBox(string name, RedComboBox checkBox) { ComboBoxes.Add(name, checkBox); }