(vb.net)textbox accepting only numeric data using keypress event and keydown event
-
(vb.net)textbox accepting only numeric data using keypress event and keydown event
-
(vb.net)textbox accepting only numeric data using keypress event and keydown event
call a function say checkForNumericInput(e) in textbox's keypress or keydown event with the event argument parameter
e
.......the code is as follows.....Private Function checkForNumericInput(ByVal e As System.Windows.Forms.KeyPressEventArgs) If Not (Char.IsDigit(e.KeyChar) Or Char.IsControl(e.KeyChar) Or e.KeyChar = ".") Then e.Handled = True MsgBox("PLEASE INPUT NUMBERS ONLY", MsgBoxStyle.Critical, "NO CHARACTERS!!!") End If End Function
hope it will be helpful.... -- modified at 4:22 Thursday 22nd March, 2007 -- modified at 4:23 Thursday 22nd March, 2007Tirtha "A man can ride on your back only when it is bent....."