ComboBox in DataGridView Display Problem

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?
 
D

Drakemar

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.
 

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