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
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