Master/Child ComboBoxes question

M

Mika M

Well...I think I'm closer to solve this when tried like this way ...

Private Sub BindControls()
Dim cb As ComboBox

'// *** Departments ***
cb = cboDepartment
cb.DataSource = ds.Tables("Departments")
cb.DisplayMember = "Department"
cb.ValueMember = "ID"

'// *** Teams ***
cb = cboTeam
cb.DataSource = ds.Tables("DepartmentTeams")'<-- relation between
departments (parent) and teams (child)
cb.DisplayMember = "Team"
cb.ValueMember = "ID"
End Sub

Private Sub cboDepartment_SelectedValueChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles cboDepartment.SelectedValueChanged
'// *** Get Teams for the selected Department ***
cboTeam.DataSource =
ds.Tables("Departments").Rows(cboDepartment.SelectedIndex).GetChildRows("Dep
artmentTeams")
End Sub

.... It is retrieving correct amount of items into cboTeams, but all items
are "System.Data.DataRow" :( How to get correct item text?
 
B

Brian Henry

I was haveing that same thing, and have not figured it out. I think it is
because they are returned as an array of data rows. But I have not figured
out how to handle that.
 

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

Similar Threads


Top