title: C# Input validation for a Textbox: float
body: <p>This supposedly easy task gave me some headache. I simply want to let the user enter any text that succeeds <code>float.TryParse</code> into a Textboxish control.</p>
  
  <p>I could use a normal TextBox and check the Text in some btnOK_Click, but this is obviously lame. Also, there is a nice built-in MaskedTextBox control, but I failed to set it's mask to be equal to <code>float.TryParse</code>. Also, it seems to check for validity only when a focus change occurs.</p>
  
  <p>Digging around on the net brought some interesting ideas, but none of them as nice as I would like.</p>
  
  <p>How did you solve this problem? Did I simply miss an obvious solution, or do I have to implement this functionality myself?</p>
  
  <p>I'm aware of a few similar threads on SO, but there was no feasible solution to be found.</p>
  
  <p><b>Update:</b> Yes, WinForms.</p>