Associate combobox value with grid

I

Irfan

hi, All

I am trying to achieve a simple programming task ie; when the user selects
an item from the comboBox ,the relevant data should be displayed in the
grid. I am using Publisher & Titles tables of Biblo.mdb as an example,
where in Publisher names are displayed in the cmbox and all the titles
related to each are disaplyed in the grid.This is what i am doing but
nothing is displayed in the grid . Can someone advise pl.

'fill the dataset & Create a relation
daPublishers.Fill(dsBiblo, "Publishers")
daTitles.Fill(dsBiblo, "Titles")
dsBiblo.Relations.Add( _
"PubTitles", dsBiblo.Tables("Publishers").Columns("PubID"), _
dsBiblo.Tables("Titles").Columns("PubID"))
cn.Close()


ComboBox1.DisplayMember = "Name"
ComboBox1.ValueMember = "PubID"
ComboBox1.DataSource = dsBiblo.Tables("Publishers")
ComboBox1.DataBindings.Add("SelectedValue", dsBiblo.Tables("Titles"),
"PubID")

gridTitles.DataSource = dsBiblo
gridTitles.DataMember = "publishers.pubTitles" 'using th relation above

TIA
Irfan
 
C

Cor Ligthert

Irfan

Can you try this one
\\\
GridTitles.SetDataBinding(DsBiblio, "Publishers.PubTitles")
///

And in my opinion can you remove that Databinding from your combobox

I hope this helps,

Cor
 

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