Question TextBox Validation

prasad kulkarni

Well-known member
Joined
Sep 7, 2009
Messages
62
Programming Experience
1-3
Hi,

validation for , allow only 2 digit after decimal point in TextBox in vb.net
eg 150.25

if any know, reply me
 
You can use IndexOf to to check if the decimal is the third digit.
VB.NET:
        If TextBox1.Text.Length - TextBox1.Text.IndexOf(".") = 3 Then
            MessageBox.Show("True")
        Else
            MessageBox.Show("False")
        End If
 
Use a NumericUpDown control, with the DecimalPlaces property set to 2.
 
Back
Top