日期:2014-05-17 浏览次数:21181 次
private void dataGridView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (sender != null)
{
if (e.KeyCode == Keys.Enter)
{
DataGridView drvc = sender as DataGridView;
if (drvc != null)
{
if (drvc.SelectedCells != null)
{
MessageBox.Show(drvc.SelectedCells[0].Value.ToString());
SendKeys.Send("{Up}");
}
}
}
}
}