Why No InputMask Property in VB6? 
Author Message
 Why No InputMask Property in VB6?

Coming from a background of VBA in Microsoft Access, I am surprised to find the InputMask property (which makes it easy to ensure proper formats for user-entered dates, phone numbers, social security numbers, etc.) missing from textbox and combobox controls in VB6. This seems like a major omission, as the alternatives are all rather clumsy by comparison.

Can anyone speak to why this property is missing from these controls in VB6?  What do you do as an alternative to ensure the proper format of input for such items?

Thanks

--
Greg Dunn



Thu, 10 Feb 2005 23:25:24 GMT  
 Why No InputMask Property in VB6?

Hi,

IMHO this is one major downfall of db programming in VB.
There are a few ways to add this functionality, but most are kludges.
You can add code to the various TextBox Events (GotFocus, LostFocus, KeyDown, KeyPress, etc.).
Don't bother with the Masked Edit Control (OCX), it is full of bugs and doesn't properly bind to the database fields.
There are other third-party controls (OCX) that may be more successful.

David
lilchips.com


  Coming from a background of VBA in Microsoft Access, I am surprised to find the InputMask property (which makes it easy to ensure proper formats for user-entered dates, phone numbers, social security numbers, etc.) missing from textbox and combobox controls in VB6. This seems like a major omission, as the alternatives are all rather clumsy by comparison.

  Can anyone speak to why this property is missing from these controls in VB6?  What do you do as an alternative to ensure the proper format of input for such items?

  Thanks

  --
  Greg Dunn



Fri, 11 Feb 2005 00:31:32 GMT  
 Why No InputMask Property in VB6?

It baffles me that it was left out of VB. I keep thinking there must be a good reason, but I haven't figured out what it is.

--
Greg Dunn

  Hi,

  IMHO this is one major downfall of db programming in VB.
  There are a few ways to add this functionality, but most are kludges.
  You can add code to the various TextBox Events (GotFocus, LostFocus, KeyDown, KeyPress, etc.).
  Don't bother with the Masked Edit Control (OCX), it is full of bugs and doesn't properly bind to the database fields.
  There are other third-party controls (OCX) that may be more successful.

  David
  lilchips.com


    Coming from a background of VBA in Microsoft Access, I am surprised to find the InputMask property (which makes it easy to ensure proper formats for user-entered dates, phone numbers, social security numbers, etc.) missing from textbox and combobox controls in VB6. This seems like a major omission, as the alternatives are all rather clumsy by comparison.

    Can anyone speak to why this property is missing from these controls in VB6?  What do you do as an alternative to ensure the proper format of input for such items?

    Thanks

    --
    Greg Dunn



Fri, 11 Feb 2005 06:39:20 GMT  
 Why No InputMask Property in VB6?

Hmmm... (In MS's shoes...)

    Hey, lets add a VB language to our office tools

    Great Idea... We can give it a combobox with a mask property.

    Thats a great idea too...

    Hey lets add that to VB...

    hmmm, not so great, why would they buy access if VB can do it all
        and do it easily...

    yeah, you're right... leave it out of VB...

D.


  It baffles me that it was left out of VB. I keep thinking there must be a good reason, but I haven't figured out what it is.

  --
  Greg Dunn

    Hi,

    IMHO this is one major downfall of db programming in VB.
    There are a few ways to add this functionality, but most are kludges.
    You can add code to the various TextBox Events (GotFocus, LostFocus, KeyDown, KeyPress, etc.).
    Don't bother with the Masked Edit Control (OCX), it is full of bugs and doesn't properly bind to the database fields.
    There are other third-party controls (OCX) that may be more successful.

    David
    lilchips.com


      Coming from a background of VBA in Microsoft Access, I am surprised to find the InputMask property (which makes it easy to ensure proper formats for user-entered dates, phone numbers, social security numbers, etc.) missing from textbox and combobox controls in VB6. This seems like a major omission, as the alternatives are all rather clumsy by comparison.

      Can anyone speak to why this property is missing from these controls in VB6?  What do you do as an alternative to ensure the proper format of input for such items?

      Thanks

      --
      Greg Dunn



Fri, 11 Feb 2005 12:03:37 GMT  
 Why No InputMask Property in VB6?
hey! i'm glad they left masks out. if masks was included i
would be tempted to use them. now i can make my own.
and don't tell me the Access masks work good. they are
terrible!

lloyd

Quote:
>-----Original Message-----
>Coming from a background of VBA in Microsoft Access, I am

surprised to find the InputMask property (which makes it
easy to ensure proper formats for user-entered dates,
phone numbers, social security numbers, etc.) missing from
textbox and combobox controls in VB6. This seems like a
major omission, as the alternatives are all rather clumsy
by comparison.
Quote:

>Can anyone speak to why this property is missing from

these controls in VB6?  What do you do as an alternative
to ensure the proper format of input for such items?
Quote:

>Thanks

>--
>Greg Dunn



Fri, 11 Feb 2005 21:31:56 GMT  
 Why No InputMask Property in VB6?
The Microsoft mask edit control does the same
functionality for text boxes. Add in in the
Project\Components

Quote:
>-----Original Message-----
>hey! i'm glad they left masks out. if masks was included
i
>would be tempted to use them. now i can make my own.
>and don't tell me the Access masks work good. they are
>terrible!

>lloyd

>>-----Original Message-----
>>Coming from a background of VBA in Microsoft Access, I
am
>surprised to find the InputMask property (which makes it
>easy to ensure proper formats for user-entered dates,
>phone numbers, social security numbers, etc.) missing
from
>textbox and combobox controls in VB6. This seems like a
>major omission, as the alternatives are all rather clumsy
>by comparison.

>>Can anyone speak to why this property is missing from
>these controls in VB6?  What do you do as an alternative
>to ensure the proper format of input for such items?

>>Thanks

>>--
>>Greg Dunn

>.



Sat, 12 Feb 2005 10:40:37 GMT  
 Why No InputMask Property in VB6?
Check past messages in this thread...
I mentioned the Masked Edit Control and also mentioned that it is buggy and
doesn't properly bind to databases.
Since the original post was concerning Access, database usage is on topic
and relevant.

David
lilchips.com


Quote:
> The Microsoft mask edit control does the same
> functionality for text boxes. Add in in the
> Project\Components

> >-----Original Message-----
> >hey! i'm glad they left masks out. if masks was included
> i
> >would be tempted to use them. now i can make my own.
> >and don't tell me the Access masks work good. they are
> >terrible!

> >lloyd

> >>-----Original Message-----
> >>Coming from a background of VBA in Microsoft Access, I
> am
> >surprised to find the InputMask property (which makes it
> >easy to ensure proper formats for user-entered dates,
> >phone numbers, social security numbers, etc.) missing
> from
> >textbox and combobox controls in VB6. This seems like a
> >major omission, as the alternatives are all rather clumsy
> >by comparison.

> >>Can anyone speak to why this property is missing from
> >these controls in VB6?  What do you do as an alternative
> >to ensure the proper format of input for such items?

> >>Thanks

> >>--
> >>Greg Dunn

> >.



Sat, 12 Feb 2005 11:05:11 GMT  
 Why No InputMask Property in VB6?
That sounds like a huge undertaking. And how would you tie it in?  In the
Change event?  Ugh!

--
Greg Dunn

Quote:
> hey! i'm glad they left masks out. if masks was included i
> would be tempted to use them. now i can make my own.
> and don't tell me the Access masks work good. they are
> terrible!

> lloyd

> >-----Original Message-----
> >Coming from a background of VBA in Microsoft Access, I am
> surprised to find the InputMask property (which makes it
> easy to ensure proper formats for user-entered dates,
> phone numbers, social security numbers, etc.) missing from
> textbox and combobox controls in VB6. This seems like a
> major omission, as the alternatives are all rather clumsy
> by comparison.

> >Can anyone speak to why this property is missing from
> these controls in VB6?  What do you do as an alternative
> to ensure the proper format of input for such items?

> >Thanks

> >--
> >Greg Dunn



Sun, 13 Feb 2005 03:26:07 GMT  
 Why No InputMask Property in VB6?
The Microsoft mask edit control does the same functionality for text boxes.
Add in in the Project\Components
<<

Well, it's something, and I'm glad to know about it (thanks!), but it's a
pathetically weak sister of the InputMask in Access. That one can tie into
the system-defined date formats (e.g., "Short Date", "Medium Date", etc.),
has nice, pre-defined formats for phone numbers, social security numbers,
and zip codes, and permits the definition of custom masks using all kinds of
special characters.  I've appended the Access help file entry on InputMask.

InputMask Property

You can use the InputMask property to make data entry easier and to control
the values users can enter in a text box control. Read/write String.

expression.InputMask

expression   Required. An expression that returns one of the objects in the
Applies To list.

Remarks
Input masks are helpful for data-entry operations such as an input mask for
a Phone Number field that shows you exactly how to enter a new number: (___)
___-____. It is often easier to use the Input Mask Wizard to set the
property for you.

The InputMask property can contain up to three sections separated by
semicolons (;).

      Section Description
      First Specifies the input mask itself; for example, !(999) 999-9999.
For a list of characters you can use to define the input mask, see the
following table.
      Second Specifies whether Microsoft Access stores the literal display
characters in the table when you enter data. If you use 0 for this section,
all literal display characters (for example, the parentheses in a phone
number input mask) are stored with the value; if you enter 1 or leave this
section blank, only characters typed into the control are stored.
      Third Specifies the character that Microsoft Access displays for the
space where you should type a character in the input mask. For this section,
you can use any character; to display an empty string, use a space enclosed
in quotation marks (" ").

In Visual Basic you use a string expression to set this property. For
example, the following specifies an input mask for a text box control used
for entering a phone number:

Forms!Customers!Telephone.InputMask = "(###) ###-####"
When you create an input mask, you can use special characters to require
that certain data be entered (for example, the area code for a phone number)
and that other data be optional (such as a telephone extension). These
characters specify the type of data, such as a number or character, that you
must enter for each character in the input mask.

You can define an input mask by using the following characters.

      Character Description
      0 Digit (0 to 9, entry required, plus [+] and minus [-] signs not
allowed).
      9 Digit or space (entry not required, plus and minus signs not
allowed).
      # Digit or space (entry not required; spaces are displayed as blanks
while in Edit mode, but blanks are removed when data is saved; plus and
minus signs allowed).
      L Letter (A to Z, entry required).
      ? Letter (A to Z, entry optional).
      A Letter or digit (entry required).
      a Letter or digit (entry optional).
      & Any character or a space (entry required).
      C Any character or a space (entry optional).
      . , : ; - / Decimal placeholder and thousand, date, and time
separators. (The actual character used depends on the settings in the
Regional Settings Properties dialog box in Windows Control Panel).
      < Causes all characters to be converted to lowercase.
      > Causes all characters to be converted to uppercase.
      ! Causes the input mask to display from right to left, rather than
from left to right. Characters typed into the mask always fill it from left
to right. You can include the exclamation point anywhere in the input mask.
      \ Causes the character that follows to be displayed as the literal
character (for example, \A is displayed as just A).

Note   Setting the InputMask property to the word "Password" creates a
password-entry control. Any character typed in the control is stored as the
character but is displayed as an asterisk (*). You use the Password input
mask to prevent displaying the typed characters on the screen.
For a control, you can set this property in the control's property sheet.
For a field in a table, you can set the property in table Design view (in
the Field Properties section) or in Design view of the Query window (in the
Field Properties property sheet).

You can also set the InputMask property by using a macro or Visual Basic.

When you type data in a field for which you've defined an input mask, the
data is always entered in Overtype mode. If you use the BACKSPACE key to
delete a character, the character is replaced by a blank space.

If you move text from a field for which you've defined an input mask onto
the Clipboard, the literal display characters are copied, even if you have
specified that they not be saved with data.

Note   Only characters that you type directly in a control or combo box are
affected by the input mask. Microsoft Access ignores any input masks when
you import data, run an action query, or enter characters in a control by
setting the control's Text property in Visual Basic or by using the SetValue
action in a macro.

When you've defined an input mask and set the Format property for the same
field, the Format property takes precedence when the data is displayed. This
means that even if you've saved an input mask, the input mask is ignored
when data is formatted and displayed. The data in the underlying table
itself isn't changed; the Format property affects only how the data is
displayed.

--
Greg Dunn

Quote:
> The Microsoft mask edit control does the same
> functionality for text boxes. Add in in the
> Project\Components

> >-----Original Message-----
> >hey! i'm glad they left masks out. if masks was included
> i
> >would be tempted to use them. now i can make my own.
> >and don't tell me the Access masks work good. they are
> >terrible!

> >lloyd

> >>-----Original Message-----
> >>Coming from a background of VBA in Microsoft Access, I
> am
> >surprised to find the InputMask property (which makes it
> >easy to ensure proper formats for user-entered dates,
> >phone numbers, social security numbers, etc.) missing
> from
> >textbox and combobox controls in VB6. This seems like a
> >major omission, as the alternatives are all rather clumsy
> >by comparison.

> >>Can anyone speak to why this property is missing from
> >these controls in VB6?  What do you do as an alternative
> >to ensure the proper format of input for such items?

> >>Thanks

> >>--
> >>Greg Dunn

> >.



Sun, 13 Feb 2005 03:38:12 GMT  
 Why No InputMask Property in VB6?

Microsoft could add InputMask to VB and there would still be plenty of reasons to choose Access over VB as the development platform for standalone (or minimal multi-user) database-centric desktop apps.  But for utilities, controls, web-based apps, and generally higher-end jobs requiring more control and having a bigger budget, VB would still be the choice.  So I don't see that as much of a reason.

Of course, that doesn't mean it wasn't the reason...  8-(

--
Greg Dunn


  Hmmm... (In MS's shoes...)

      Hey, lets add a VB language to our office tools

      Great Idea... We can give it a combobox with a mask property.

      Thats a great idea too...

      Hey lets add that to VB...

      hmmm, not so great, why would they buy access if VB can do it all
          and do it easily...

      yeah, you're right... leave it out of VB...

  D.


    It baffles me that it was left out of VB. I keep thinking there must be a good reason, but I haven't figured out what it is.

    --
    Greg Dunn

      Hi,

      IMHO this is one major downfall of db programming in VB.
      There are a few ways to add this functionality, but most are kludges.
      You can add code to the various TextBox Events (GotFocus, LostFocus, KeyDown, KeyPress, etc.).
      Don't bother with the Masked Edit Control (OCX), it is full of bugs and doesn't properly bind to the database fields.
      There are other third-party controls (OCX) that may be more successful.

      David
      lilchips.com


        Coming from a background of VBA in Microsoft Access, I am surprised to find the InputMask property (which makes it easy to ensure proper formats for user-entered dates, phone numbers, social security numbers, etc.) missing from textbox and combobox controls in VB6. This seems like a major omission, as the alternatives are all rather clumsy by comparison.

        Can anyone speak to why this property is missing from these controls in VB6?  What do you do as an alternative to ensure the proper format of input for such items?

        Thanks

        --
        Greg Dunn



Sun, 13 Feb 2005 03:46:09 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Referencing Field Properties InputMask and Format, using VB/VBA

2. Trouble adding InputMask property to fields...

3. InputMask Property

4. VB6 ListView: Why oh why oh why...

5. VB6 ListView: Why oh why oh why...

6. why why why why

7. Why why why why?

8. VB6: Property Sheets Bug?, Custom Controls and properties

9. VB6 Text property of UserControl does not work with UpDown Control's buddy property

10. Properties window goes blank when Data Source property clicked- VB6 CR 7

11. InputMask and Access Error codes

12. Help on inputmask

 

 
Powered by phpBB® Forum Software