DECIMAL NUMBER VALIDATION IN VB.NET

How to give DECIMAL validate in textbox(10.00,10.52......)
take keypress event of textbox



Private Sub Txtspr_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Txtspr.KeyPress
Dim HND_FLG As Boolean = False
Dim POINT_FOUND As Boolean = False
Dim y As String = Txtspr.Text
Dim i As String = e.KeyChar.ToString
If i = "" Then
Else
If i = "." Then
For Each asd As Char In y
If asd = "." Then
HND_FLG = True
End If
Next
If HND_FLG Then
e.Handled = True
End If
Else
If IsNumeric(i) Then
Else
e.Handled = True
MessageBox.Show("Enter valid Number")
End If
End If
End If
End Sub

2 comments:

Unknown said...

niceeeee

kamal said...

hey man thats cool... i like it... thanks..