Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27186

VS 2008 How to cast datakey in a DataBinding

$
0
0
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:
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

Is there some possibility to cast this binding?

Viewing all articles
Browse latest Browse all 27186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>