Suppose I have designed a DataGridView to have a comboBoxColumn named 'dataGridViewComboBocColumn'.
I can populate the comboBox using the following code:
private void DataGridViewForm_Load(object sender, EventArgs e)
{
BookCollection books = Book.GetAllBooks();
foreach (Book b in books)
{
dataGridViewComboBocColumn.Items.Add(b);
}
dataGridViewComboBocColumn.DisplayMember = "BookName";
dataGridViewComboBocColumn.ValueMember = "BookISBN";
}
But how can I retrieve a selected item object. So that I can cast and convert that item into a Book - object.