[comp.windows.ms.programmer] Field-level validation in dialog/edit?

al@well.sf.ca.us (Alfred Fontes) (05/09/91)

Does anybody have an opinion about the fastest and simplest way to check
the format of data typed into edit controls?  For example, making sure
that a number is actually a floating-point number within the required
range?  Is there any source code around to perform this kind of checking?

Al Fontes
al@well.sf.ca.us
uunet!apple!well!al

drift@qut.edu.au (Glenn Wallace) (05/11/91)

In article <24676@well.sf.ca.us>, al@well.sf.ca.us (Alfred Fontes) writes:
> Does anybody have an opinion about the fastest and simplest way to check
> the format of data typed into edit controls?  For example, making sure
> that a number is actually a floating-point number within the required
> range?  Is there any source code around to perform this kind of checking?
> 
> Al Fontes
> al@well.sf.ca.us
> uunet!apple!well!al

Funny you should mentions this... we just recently asked MS about it.

Their suggestion was to sub-class the edit control, and handle
the keystrokes there and filter them, but it still sounds kinda messy.
Of course, you can also either write your own edit control (cough!)
or validate on termination of the dialog (not user-friendly).

We wanted an edit field, with an almost (gasp) cobol like picture
clause.

They also suggested we use the Excel "cell" format definition standard
and translate the cobol pic clauses to that.

But overall, no big help as to how to code it.

+-------------------+-----------------------------------------+
| Glenn Wallace     | Net: drift@qut.edu.au                   |
| Drift Project     | Fone: +61 7 837-7126 Fax: +61 7 221-0173|
| Telecom Australia | Snail: 11th Flr 144 Edward St.,         |
+-------------------+        Brisbane, Q4000 Australia        |
|                                                             |
| Disclaimer - The opinions expressed must be my own, because |
|              Telecom is a statuatory authority and as such, |
|              is not capable of having opinions.             |
+-------------------------------------------------------------+