I have a Function for checking the input in a textbox and only allowing Numeric & Backspace; everything works fine so far.
My form is for financials and it has about 20 textboxes; they all receive Numeric only data; there is NO alpha data on the entire form required.
Note in the snippet below that I don't even need a decimal point as well.
Is there a way to handle ALL textboxes on this form without having to place the Function call in each textbox KeyPress event.
Relatively new to VB.NET, took a long (5 year) hiatus from developing VB6, appreciate your input.
Public Function TrapKey(ByVal KCode As String) As Boolean If (KCode >= 48 And KCode <= 57) Or KCode = 8 Then TrapKey = False Else TrapKey = True End If End Function 'Calling the function on each textbox KeyPress event as: e.Handled = TrapKey(Asc(e.KeyChar))