/ Published in: VB.NET

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
' 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
Comments
