With a listbox, I have the following code to extract the item selected:
private void inventoryList_SelectedIndexChanged(object sender, EventArgs e) { String s = inventoryList.SelectedItem.ToString(); s = s.Substring(0, s.IndexOf(':')); bookDetailTable.Rows.Clear(); ... more code ... }
I want to do something similar for a DataGridView, that is, when the selection changes, retrieve the contents of the first cell in the row selected. The problem is, I don’t know how to access that data element.
Any help is greatly appreciated.
I think that this is what you’re looking for. But if not, hopefully it will give you a start.