On Form Level, I use following codes to make textboxes to accept only numbers,
How to add these codes in main module, instead of of writing these codes on every form.
Please modify
Please help
How to add these codes in main module, instead of of writing these codes on every form.
Please modify
VB.NET:
If TypeName(Me.ActiveControl) = "TextBox" Then
With Me.ActiveControl
If Not IsNumeric(.Text) And .Text <> vbNullString Then
MsgBox("Sorry, only numbers allowed")
.Text = vbNullString
.Text = Nothing
End If
End With
End If
Last edited: