You can use the DataGridView's EditingControlShowing event to create and add an event to the textbox. You can add a KeyPress event, KeyUp, KeyDown, TextChanged....anything. You just need a method that has the matching arguments that the textbox event has.
For example, here is what I've used in the past to only allow numeric and decimal points in the textbox of a datagridview:
Private Sub gvMast_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles dgvCLUs.EditingControlShowing
Select Case e.Control.GetType
Case GetType(System.Windows.Forms.DataGridViewTextBoxEditingControl)
Dim txtTemp As TextBox = CType(e.Control, TextBox)
RemoveHandler txtTemp.KeyPress, AddressOf GridTextbox_NumericWithDecimal_KeyPress
AddHandler txtTemp.KeyPress, AddressOf GridTextbox_NumericWithDecimal_KeyPress
End Select
End Sub
Private Sub GridTextbox_NumericWithDecimal_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
e.Handled = IsNumericWithDecimalKeyPress(e.KeyChar)
End Sub
Public Function IsNumericWithDecimalKeyPress(ByVal myKeyChar As Char) As Boolean
If Char.IsDigit(myKeyChar) Or Char.IsControl(myKeyChar) Or myKeyChar = "." Then
Return False
Else
Return True
End If
End Function