在datagridview中添加keydown事件
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode==Keys.Enter)
{
String currentCol = this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
}
}