MaskedTextBox in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes the MaskedTextBox control


This control is a TextBox that provides a mask that helps the user in entering a value in a particular format. The mask determines which characters are allowed at different positions in the text, displaying placeholder characters to help prompt the user and underscores where the user can enter characters.

For example, an empty United States phone number field would appear as following:

phone example

You set the Mask property either in Design view or programmatically:

design view

input mask

    MaskedTextBox1.Mask = "(999) 000-0000"

You may also want to use the BeepOnError property which determines whether the control beeps whenever the user types an invalid keystroke.

Previous Lesson | Next Lesson

Share This

Home | About | Contact | Privacy Policy

Copyright 2018 - All Rights Reserved.