just forgot, I knew this "Textbox1.text = format(textbox1.text, “####.00”)" will set up the format to 4number with two decimal - 1234.00, how about if the user enter 12345.00, five number with two decimal, how did you do the check and give error message? Thanks.

if you Import System.Text.RegularExpressions then you can use the following test

If RegEx.IsMatch(textbox.Text,"\d{4}\.\d{2}") Then
    'the text matches the pattern ####.##
Else
    MsgBox("the text must be in the form ####.##")
End If

'or if you don't want to do the import you can fully qualify as

If System.Text.RegularExpressions.RegEx.IsMatch(textbox.Text,"\d{4}\.\d{2}") Then
    'the text matches the pattern ####.##
Else
    MsgBox("the text must be in the form ####.##")
End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.