title: How can I validate input to the edit control of a cell in a DataGridView?
body: <p>It appears that the only way to capture the keypress events within a cell of a DataGridView control in order to validate user input as they type, is to use the DataGridView controls OnEditControlShowing event, hook up a method to the edit control's (e.Control) keypress event and do some validation.</p>
  
  <p>My problem is that I've built a heap of custom DataGridView column classes, with their own custom cell types. These cells have their own custom edit controls (things like DateTimePickers and Numeric or Currency textboxes.)</p>
  
  <p>I want to do some numeric validation for those cells that have Numeric of Currency Textboxes as their edit controls but not all the other cell types.</p>
  
  <p>How can I determine, within the DataGridView's "OnEditControlShowing" override, whether or not a particular edit control needs some numeric validation?</p>