Another method may be to use the public event Validating - inherited from Control. Unlike Pirate's example, where you capture keystrokes (which is very cool and gives you lots of control), this event fires after you leave the control.
There's a good example in the help where this event is explained.
The demo I've uploaded can capture keys too that you don't need . That would prevent the user from typing more than 5 chars in textchanged event (which is more efficient way than validating after the user finishes typing ) .Can you tell more about things about that Mike Hildner .
Personally, I like capturing the key presses, because it gives you a lot of control. Whether it's more effecient or not, I don't know. I just wanted to mention another method. Always nice to have options.
Well , I know it's good , but this can exactly does the job as Validation (although the latter has some problems , and sometimes guys suffer from it ).
also, I have two textboxes that are going to accept prices. One is going to accept the Total and the other Sales Tax. I need to add these to values and store it into a variable. What do I declare the variable as? A double or a decimal?
The most suitable variable type for this case would be Decimal which can handle more digits on both sides of the decimal point .
Why don't you use any array instead of variables ?