Maskedtextbox control windows forms




















The MaskedTextBox lets you change the character that appears when a password is entered. It also allows you to change the prompt character.

These two properties are usability features of the MaskedTextBox control. And: If your user types either of those characters, and the MaskedTextBox has one of those characters, this is considered valid input. The MaskedTextBox control in Windows Forms enforces the range of input that is allowed into the text box.

It is ideal for when you want to collect phone numbers, identification numbers, dates or times, or even simple integers. Note: Implementing these same features is much harder if you use the plain TextBox. MaskedTextBox accepts text input of a specific format. TextBox Start.

We show a MessageBox that details the DateTime. ReturnValue; MessageBox. Privacy policy. However, if the format of your data in the database does not match the format expected by your mask definition, you will need to reformat the data. The following procedure demonstrates how to do this using the Format and Parse events of the Binding class to display separate phone number and phone extension database fields as a single editable field.

The following procedure requires that you have access to a SQL Server database with the Northwind sample database installed. Set the Mask property of PhoneMask to x Right-click the form and choose View Code. Place this code anywhere in your form class. Add event handlers for the Format and Parse events to combine and separate the PhoneNumber and Extension fields from the bound DataSet. Contact Us. Sign In. Developer Platform Overview.

My Dashboard. Find anything about our product, documentation, and more. Please share your comments and questions with us. Please enable cookies in your browser. I would like for an account to be created and to be contacted regarding this message. No further action will be taken. Privacy policy , and Cookie Policy. Thank you for your feedback and comments.

We will process this request shortly and get back to you if required. Numeric values can be formatted based on culture. Watermark text support when value is null.



0コメント

  • 1000 / 1000