lothos12345
Junior Contributor
Using visual basic I want to prevent the user from entering '*' into a textbox. How can this be done? Any help offered is greatly appreciated.
Public Class ExtendedTextbox
Inherits System.Windows.Forms.TextBox
Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
If e.KeyChar = "*" Then
e.Handled = True
End If
End Sub
End Class
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
Text = Text.Replace("*", "")
End Sub