The Mask property of the Masked Text Box control specifies what input mask to use.The mask must be a string composed of one or more of the masking elements from the following table.
Optionally, invalidates the child controls assigned to the control.(Inherited from Control.)Invalidates the specified region of the control (adds it to the control's update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the control.(Inherited from Control.)Invalidates the specified region of the control (adds it to the control's update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the control.Walkthrough: Validating That Passwords Are Complex How to determine whether a string has the characteristics of a strong password.Does anyone know how to set the maskedtextbox to a currency format that actually works?Don't forget to include the Number Format Info, it will deal with commas and numebr signs.control in Visual Basic 6.0 and should be familiar to users migrating from that platform.Although you can use regular expressions and masks to validate user input, they are not completely equivalent.
Regular expressions can express more complex patterns than masks, but masks can express the same information more succinctly and in a culturally relevant format.
The decimal (.), thousandths (,), time (:), date (/), and currency ($) symbols default to displaying those symbols as defined by the application's culture.
You can force them to display symbols for another culture by using the Format Provider property.
A , DCSE, e-Biz , i-Net , MCDST, MCP, Network , Security , A. NET Calendar Control | Useful Win Form Controls | Regular Expression (Regex) Library | Backup/Restore SQL Server 2005 Database using code | Verify SQL Server 2005 database backup using SMO | Backup SQL Server 2005 database using SMO | Restore SQL Server 2005 database using SMO | Use Fx Cop from Microsoft to aid with code optimization The Masked Text Box is not a panacea because it requires a fixed length mask. Just use a Numberic Up Down with the Decimal Places property set to 2 or a regular Text Box and validate it for currency: Why is my data not saved to my database? NET using Visual Basic 2010 Express.) If the user manually entered a "$" into the textbox there an unhandled exception would result.
| MSDN Data Walkthroughs VBForums Database Development FAQ My Code Bank Submissions: VB | C# My Blog: Data Among Multiple Forms (3 parts) Beginner Tutorials: VB | C# | SQL I found the above code by jmcilhinney to be very helpful. I eventually fixed this by adding one line of code into the Sub Textbox1_Validating(...).
So I immediately tried the Masked Text Box that would fit my needs (with a Mask like "€ 00000.00"), if it weren't for the focus and the length of the mask.