vb.net

位置:IT落伍者 >> vb.net >> 浏览文章

VB.NET中让Textbox只能输入数字


发布日期:2018年11月14日
 
VB.NET中让Textbox只能输入数字

Public Class Form

Inherits SystemWindowsFormsForm

#Region Windows 窗体设计器生成的代码

Public Sub New()

MyBaseNew()

该调用是 Windows 窗体设计器所必需的

InitializeComponent()

在 InitializeComponent() 调用之后添加任何初始化

End Sub

窗体重写 dispose 以清理组件列表

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

componentsDispose()

End If

End If

MyBaseDispose(disposing)

End Sub

Windows 窗体设计器所必需的

Private components As SystemComponentModelIContainer

注意: 以下过程是 Windows 窗体设计器所必需的

可以使用 Windows 窗体设计器修改此过程

不要使用代码编辑器修改它

Friend WithEvents TextBox As SystemWindowsFormsTextBox

Private Sub InitializeComponent()

MeTextBox = New SystemWindowsFormsTextBox

MeSuspendLayout()

TextBox

MeTextBoxLocation = New SystemDrawingPoint( )

MeTextBoxName = TextBox

MeTextBoxTabIndex =

MeTextBoxText =

Form

MeAutoScaleBaseSize = New SystemDrawingSize( )

MeClientSize = New SystemDrawingSize( )

MeControlsAdd(MeTextBox)

MeName = Form

MeText = Form

MeResumeLayout(False)

End Sub

#End Region

Dim str As String =

Private Sub TextBox_KeyUp(ByVal sender As Object ByVal e As SystemWindowsFormsKeyEventArgs) Handles TextBoxKeyUp

If (eKeyValue > And eKeyValue < ) Or (eKeyValue > And eKeyValue < ) Or (eKeyValue = ) Or (eKeyValue = ) Or (eKeyValue = ) Then

str = TextBoxText

Else

TextBoxText = str

TextBoxFocus()

End If

End Sub

End Class

上一篇:ADO在vb.net中的使用(与datagrid结合)

下一篇:用VB.NET轻松制作特效窗体