Hey everyone! I suppose this is my first post on StackOverFlow.com :-)
I\'ve been having this problem for a while. To make it all simple, suppose we have 2 database tabl
This should work:
// create the column (probably better done by the designer)
DataGridViewComboBoxColumn categoryColumn = ...
// bind it
categoryColumn.DataSource = db.Categories.ToList();
categoryColumn.DisplayMember = "catName"; // display category.catName
categoryColumn.ValueMember = "id"; // use category.id as the identifier
categoryColumn.DataPropertyName = "catId"; // bind the column to book.catId
I managed to do it by overwriting the ToString() method in the concerned class. For you case, you could add in the definition of categories:
public override string ToString()
{
return this.catName
}