title: Allow only 2 Decimal points
body: <p>In window textbox, I'd like to just allow <strong>2 decimal points</strong> only. I could set text box only numeric but don't know how to limit 2 decimal points.</p>
  
  <p>For example, 743.56</p>
  
  <p>My code is below </p>
  
  <pre><code>  Private Sub txtPrice_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrice.KeyPress        
      'allow numeric 
      If Not Char.IsControl(e.KeyChar) AndAlso Not Char.IsDigit(e.KeyChar) AndAlso e.KeyChar &lt;&gt; "."c Then
          e.Handled = True
      End If
  
      ' only allow one decimal point
      If e.KeyChar = "."c AndAlso TryCast(sender, TextBox).Text.IndexOf("."c) &gt; -1 Then
          e.Handled = True
      End If
  
     End Sub
  </code></pre>
  
  <p>How to?</p>