DataGridView DataGridViewComboBoxColumn

N

Nathan Franklin

Hey List,

I am trying display a combobox in place of one of my columns in my
DataGridView.
I create the combo box column and assign the
DataGridViewComboBoxColumn.datasource to a datasource to load in value for
my combo box. The fields I use are ID and Description.
I have set the DisplayMember to Description and the ValueMember to ID, but
after the values are loaded in and i set the data source of the dataviewgrid
my combobox column displays the value that has come from the DataSource of
the DataViewGrid.

How can I display to DisplayMember to screen after data has been loaded?

Here is my code below..

' create FieldType column
Dim cmbColFieldType As New DataGridViewComboBoxColumn
cmbColFieldType.DropDownWidth = 160
cmbColFieldType.MaxDropDownItems = 3
cmbColFieldType.FlatStyle = FlatStyle.Flat
cmbColFieldType.DataSource = InteriorSetupTables.Tables("FieldTypes") '
contains values ID and Description
cmbColFieldType.DataPropertyName = "FieldType"
cmbColFieldType.DisplayMember = "Description" ' is a String Value
cmbColFieldType.ValueMember = "ID" ' ID is an INT value
cmbColFieldType.HeaderText = "Field Type"
cmbColFieldType.Name = "FieldType"
cmbColFieldType.ValueType = GetType(System.Int32)
dgExtendedDataSets.Columns.Add(cmbColFieldType)

' SET THE DATASOURCE FOR THIS GRID
dgExtendedDataSets.AutoGenerateColumns = False
dgExtendedDataSets.DataSource = ExTable ' exTable contains columns including
FieldType which is an int value


Thanks very much!
Nathan
 
N

Nathan Franklin

I should add..

The combobox values are listed in the combobox ok, but it just isnt updating
the datagridview's screen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top