110,533
社区成员
发帖
与我相关
我的任务
分享
TextBox cell;//初始化一个文本框
private void dgv_M_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
cell = new TextBox();
cell = (TextBox)e.Control;//把当前编辑的单元格转换成文本框
cell.KeyPress += new KeyPressEventHandler(cell_KeyPress);
}
private void cell_KeyPress(object sender, KeyPressEventArgs e)
{
//这里判断输入的每个字符
}