0

Originally I was using

Decimal.TryParse(input, New Decimal)

to figure out of user input is valid money. This works for most cases, except I only want to accept money within 2 digits, so "10.001" should not be accepted.

I looked all over SO for this simple and I imagine common issue but could not find an answer.

Christopher Bales
  • 1,069
  • 1
  • 13
  • 23

1 Answers1

1

Mark in the discussion solved this for me. Thanks! Here's the VB.net code for what I was looking for:

 Dim regex As Regex = New Regex("[0-9]?[0-9]?(\.[0-9]?[0-9]$)")
 Dim match As Match = regex.Match(input)
 If Not match.Success Then
Christopher Bales
  • 1,069
  • 1
  • 13
  • 23