code_junkie

Raise CellValueChanged from a custom editing control in a DataGridView

Nov 11th, 2011
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public class DataGridViewNumericTextBoxEditingControl : DataGridViewTextBoxEditingControl
  2. {
  3. protected override void OnKeyPress(KeyPressEventArgs e)
  4. {
  5. e.Handled = Char.IsLetter(e.KeyChar);
  6. if (!e.Handled)
  7. RaiseDataGridViewCellValueChanged(); // <-- Any way?
  8. }
  9. }
  10.  
  11. public class DataGridViewNumericTextBoxEditingControl : DataGridViewTextBoxEditingControl
  12. {
  13. protected override void OnKeyPress(KeyPressEventArgs e)
  14. {
  15. e.Handled = Char.IsLetter(e.KeyChar);
  16. if (!e.Handled)
  17. {
  18. EditingControlDataGridView.EndEdit();
  19. EditingControlDataGridView.BeginEdit(false);
  20. }
  21. }
  22. }
Add Comment
Please, Sign In to add comment