Page 1 of 1

Masked Edit Control VB6 Some basics about Masked Edit Control Rate Topic: -----

#1 theunborncoder   User is offline

  • D.I.C Head
  • member icon

Reputation: 13
  • View blog
  • Posts: 123
  • Joined: 15-October 09

Post icon  Posted 12 November 2009 - 12:12 AM

The Masked Edit control provides restricted data input as well as formatted data output.

If you define an input mask using the Mask property, each character position in the Masked Edit control maps to either a placeholder of a specified type or a literal character.

If you attempt to enter a character that conflicts with the input mask, the control generates a Validationerror event. The input mask prevents you from entering invalid characters into the control.

The Masked Edit control also validates the values of the Text property at run time. If you set the Text property so that it conflicts with the input mask, the control generates a run-time error.

The MaskedEdit control is used to prompt users for data input using a mask pattern. You can also use it to prompt for dates, currency, and time, or to convert input data to all upper- or lowercase letters. For example, to prompt the user to enter a phone number, you can create the following input mask: "(___) - ___ - ____". If you don't use an input mask, the MaskedEdit control behaves much like a standard text box.

To create an input mask, you combine mask characters with literal characters. Literal characters are characters which rather than representing some data type or format, are used as themselves. For example, to create an input mask for a phone number you define the Mask property as follows:

MaskEdBox1.Mask = (###) - ### - ####

At run time, the MaskedEdit control would look like the following:
"(___) - ___ - ____"

If you want to use a mask character as a literal, you can precede the mask character with a backslash (\). For example, if you want the pound sign (#) to display, you set the mask as follows:

MaskEdBox1.Mask = "\##"

You use the Format property with the Mask property. For example, to create a mask that prompts for a Short Date input that displays in the Long Date format, you set the Mask and Format properties as follows:

MaskEdBox1.Mask = "##-##-##"
MaskEdBox1.Format = "dddddd"

When the user enters the date in the short format (11-12-09, for instance), the MaskedEdit control verifies that the entered data is valid, and then, when the focus passes to the next control, it is displayed as "Thursday, November 12, 2009".

Is This A Good Question/Topic? 0
  • +

Replies To: Masked Edit Control VB6

#2 Fredex   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 86
  • Joined: 16-January 12

Posted 11 February 2012 - 06:35 AM

On what component of VB6 the MaskEdit control be found???
Was This Post Helpful? 0
  • +
  • -

#3 gvbg90210   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 18-June 12

Posted 18 June 2012 - 07:16 PM

It is a control that ships with Visual Basic 6. You can add it to your project by going to Project, Components. This was answered in detail on this post: VB6 Masked Edit Control
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1