private void giochiDataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
TextBox innerTextBox;
if (e.Control is TextBox)
{
innerTextBox = e.Control as TextBox;
// innerTextBox.KeyDown -= new KeyEventHandler(innerTextBox_KeyDown);
// innerTextBox.KeyDown += new KeyEventHandler(innerTextBox_KeyDown);
innerTextBox.KeyPress -= new KeyPressEventHandler(innerTextBox_KeyPress);
innerTextBox.KeyPress += new KeyPressEventHandler(innerTextBox_KeyPress);
}
}
private void innerTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 46)
{
SendKeys.Send(","); //manda la virgola al posto del .
e.Handled = true; //fa in modo che il . non vada nell'input
}
}
Commenti