You will need to set up a KeyPress event handler for each cell.
So - handle the DGV EditingControlShowing event. Within the handler, filter for the cells you are interested in and, for those cells, add a new KeyPressEventHandler.
e.g.
public class MyDgv : DataGridView
{
protected override void OnEditingControlShowing(DataGridViewEditingControlShowingEventArgs e)
{
base.OnEditingControlShowing(e);
if (this.CurrentCell.ColumnIndex == 0)
{
e.Control.KeyPress -= new KeyPressEventHandler(MyDgv_OnKeyPress);
e.Control.KeyPress += new KeyPressEventHandler(MyDgv_OnKeyPress);
}
}
private void MyDgv_OnKeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 't')
{
int val = int.Parse(((DataGridViewTextBoxEditingControl)sender).Text) * 1000;
((DataGridViewTextBoxEditingControl) sender).Text = val.ToString();
e.Handled = true;
}
}
}
I'm sure there are other ways, but this works for me.