使用列表框,我有以下代码来提取所选项目:
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. 问题是,我不知道如何访问该数据元素。
任何帮助是极大的赞赏。