ComboBox in DataGridView Display Problem

  • Thread starter Thread starter Drakemar
  • Start date Start date
D

Drakemar

What I thought was a real simple thing to do has out not to be. I have
a real simple Access database with two tables:

Student Table
id (autonumber) *primary key*
name (text)
teacherID (int) *foreign key*

Teacher
id (autonumber) *primary key* relationship to Student.teacherID
name (text)

My datagridview bindingsource is to table students. All I want to do
is have a ComboBox in the teacherID column that has a .DisplayMember of
the Teacher.name.

How do I do this?
 
I apparently found the solution to my problem. It was a simple
solution, and I'm not sure what I did wrong in the first place.

Steps to follow for anyone in the future:
1) Drop the datagridview on the table
2) Edit the column of your parent table to be displayed as a
DataGridComboBox
3) Change the datasource to be that of your parent table
4) Edit the DisplayMember to be that of you wish (in my case the "name"
field in the parent table.
5) Change the valueMember field to be the foreign key.
 
Back
Top