Return to Snippet

Revision: 34189
at October 19, 2010 04:37 by indra


Initial Code
' Number with comma
Private Sub NumberTextBox_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles NumberTextBox.KeyPress
        Dim tb As TextBox = sender

        If Not (Char.IsDigit(e.KeyChar) Or Char.IsControl(e.KeyChar) Or (e.KeyChar = "," And tb.Text.IndexOf(",") < 0)) Then

            e.Handled = True

        End If

    End Sub

' Just Number
Private Sub NumberTextBox_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles NumberTextBox.KeyPress
        Dim tb As TextBox = sender

        If Not (Char.IsDigit(e.KeyChar) Or Char.IsControl(e.KeyChar)) Then

            e.Handled = True

        End If

    End Sub

Initial URL

                                

Initial Description

                                

Initial Title
Textbox Numeric Input

Initial Tags

                                

Initial Language
VB.NET