private void BindData() { this.prepareDataSet(); DataTable dtParam = parameterDataSet.Tables[0]; DataTable dtType = this.prepareDataTableForType(); DataGridTableStyle tableStyle = new DataGridTableStyle(); tableStyle.MappingName = "ParamTable"; DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn(this.parameterGrid, dtParam, "paramtype"); for (int i = 0; i < dtParam.Columns.Count; ++i) { if (dtParam.Columns[i].ColumnName != "paramtype") { DataGridColorTextBoxColumn TextCol = new DataGridColorTextBoxColumn(parameterGrid, dtParam, dtParam.Columns[i].ColumnName); TextCol.MappingName = dtParam.Columns[i].ColumnName; TextCol.HeaderText = dtParam.Columns[i].ColumnName; TextCol.Width = 95; tableStyle.GridColumnStyles.Add(TextCol); } else { ComboTextCol.MappingName = "paramtype"; //must be from the lattice table... ComboTextCol.HeaderText = "Type"; ComboTextCol.Width = 150; ComboTextCol.ColumnComboBox.DataSource = dtType; ComboTextCol.ColumnComboBox.DisplayMember = "paramType"; //use for display value in combo ComboTextCol.ColumnComboBox.ValueMember = "paramType"; // also use for value member in combo tableStyle.PreferredRowHeight = ComboTextCol.ColumnComboBox.Height + 2; tableStyle.GridColumnStyles.Add(ComboTextCol); } } parameterGrid.TableStyles.Clear(); parameterGrid.TableStyles.Add(tableStyle); parameterGrid.DataSource = dtParam; }