c#如何实现在datagridview中按回车键保存数据,按delete删除数据??

[复制链接]
查看11 | 回复2 | 2013-2-7 10:23:25 | 显示全部楼层 |阅读模式
private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)//回车键
{
string ID = dataGridView1.SelectedCells[0].Value.ToString();
string sql = string.Format("updateBook set BookName='{0}' where BookID={1}", dataGridView1.Sele...
回复

使用道具 举报

千问 | 2013-2-7 10:23:25 | 显示全部楼层
private void dataGridView1_KeyUp(object sender, KeyEventArgs e)
{
if(e.KeyValue==13)
MessageBox.Show("保存数据");
else if(e.KeyValue...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行