Add a validText property to get a valid text input by inheriting TextBox.
There is also an editable property that determines whether the text box supports the return editing.
I just learned VB.NET, I hope to communicate with you, I have QQ: 36745349
Public class mytextbox inherits system.windows.forms.textbox private m_strvalidtext as string = "0123456789. -" & chr (13) .tostring private m_blneditable as boolean = true
#Region "Windows Form Designer Generated Code"
Public Sub New () MyBase.new () 'This call is required for the Windows Form Designer. InitializeComponent ()
'Add any initialization after INITIALIZECOMPONENT ()
End Sub
'UserControl1 Rewinds Dispose to clean the component list. Protected overloads overrides sub dispose (byval disposing as boolean) ing disponation kiln (Components Is Nothing) Then components.dispose () end if endiffs) End Sub
'Windows Form Designer Supply Private Components as System.comPonentModel.icontainer
'Note: The following procedure is necessary to use the Windows Form Designer to modify this process using the Windows Form Designer. 'Don't modify it using the code editor.
#End region
Private Sub MyTextBox_KeyPress (ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress Dim strLocalString As String If EditAble Then strLocalString = m_strValidText & Chr (8) .ToString Else strLocalString = m_strValidText End If If UCase ( Strlocalstring) .indexof (ucase (e.keychar)) <0 Then E.handled = true beep () else