Hello!
I have a DataGridView which is bound to a DataTable populated from database. I have added a ComboBoxColumn to the DataGridView.
The first two ComboBoxColumns get populated from a DataTable created within my code, but now I need to populate it from the database.
I populated the "possibleAlternativeValues" from the database and I set up the bindingSource.
BUT, the ID in one table is Integer and the corresponding ID in another table is Double (the database has no relations set up).
Now I need to set some sort of cast in the BindingSource.
The code related to this is:
Is there some possibility to cast this binding?
I have a DataGridView which is bound to a DataTable populated from database. I have added a ComboBoxColumn to the DataGridView.
The first two ComboBoxColumns get populated from a DataTable created within my code, but now I need to populate it from the database.
I populated the "possibleAlternativeValues" from the database and I set up the bindingSource.
BUT, the ID in one table is Integer and the corresponding ID in another table is Double (the database has no relations set up).
Now I need to set some sort of cast in the BindingSource.
The code related to this is:
Code:
myBindingSource.DataSource = "heap_id" 'defined as Double in database
With gredaComboboxColumn
.DataSource = myDataTableWithChoices
.DataPropertyName = myBindingSource.DataSource()
.DisplayMember = "title"
.ValueMember = "id" 'type of id in the table from which myDataTableWithChoices get's populated is set to Integer
.HeaderText = "Greda1"
End With