hjs
October 11th, 2009, 02:13 PM
Hi,
I bind my datagridview to a bindingsource at runtime. I manually add an
extra DataGridViewComboBoxColumn to the datagridview, which I bind to another
datatable that is not in the datasource. When I select a value in the
DataGridViewComboBoxColumn then it first displays the DisplayMember but when
I leave the cell it displays the ValueMember. In my opinion the cell should
display the DisplayMember. What am I missing?
dgvTransacties.DataSource = bsTransacties;
DataGridViewComboBoxColumn newCol = new DataGridViewComboBoxColumn();
newCol.DataSource = ds.Tables["Rubriek"];
newCol.DisplayMember =
ds.Tables["Rubriek"].Columns["Uitgavepost"].ColumnName;
newCol.ValueMember = ds.Tables["Rubriek"].Columns["Id"].ColumnName;
newCol.DataPropertyName =
ds.Tables["Transactie"].Columns["Post"].ColumnName;
newCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
dgvTransacties.Columns.Add(newCol);
Thnx
hjs
I bind my datagridview to a bindingsource at runtime. I manually add an
extra DataGridViewComboBoxColumn to the datagridview, which I bind to another
datatable that is not in the datasource. When I select a value in the
DataGridViewComboBoxColumn then it first displays the DisplayMember but when
I leave the cell it displays the ValueMember. In my opinion the cell should
display the DisplayMember. What am I missing?
dgvTransacties.DataSource = bsTransacties;
DataGridViewComboBoxColumn newCol = new DataGridViewComboBoxColumn();
newCol.DataSource = ds.Tables["Rubriek"];
newCol.DisplayMember =
ds.Tables["Rubriek"].Columns["Uitgavepost"].ColumnName;
newCol.ValueMember = ds.Tables["Rubriek"].Columns["Id"].ColumnName;
newCol.DataPropertyName =
ds.Tables["Transactie"].Columns["Post"].ColumnName;
newCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
dgvTransacties.Columns.Add(newCol);
Thnx
hjs