View Full Version : Masked edit field question

Brandon Lowe
06-25-2008, 01:03 PM
I'm creating a custom dialog with a masked edit field. I'm not sure what to use in the mask.
Right now it is <#####-#####-#####-#####-#####>
this work but only lets me enter numbers. What should I use for Alphanumeric in the mask?

06-25-2008, 01:49 PM
Try using <^^^^^-^^^^^-^^^^^-^^^^^-^^^^^>

Brandon Lowe
06-27-2008, 11:00 AM
That mask will still let me enter in %^&* and charators like that. Is there a way to mask out those? I just want letters and numbers.

06-27-2008, 11:46 AM
You are correct, this format allows all characters. So you just want a limited set [0-9][A-Z][a-z], correct?

Unfortunately I have not found a way to implement a mask that does this. I just have to check the results and report back to the user that they entered an illegal character.

06-27-2008, 12:00 PM
I went back to the instructions for the Masked Edit control on MSDN (http://msdn.microsoft.com/en-us/library/aa369797(VS.85).aspx)and I am a bit confused by the instructions.

Look at this quote:
The alternate digit, %, and alternate alphanumeric characters, ^, ?, and ` fields allow custom actions to differentiate between fields in a way that can be controlled by the mask, for example, ^ can be used for fields that should be uppercase.

Our use of the carrot symbol, ^, does not force upper case characters, so perhaps my understanding of the rules is incorrect.

Hopefully Robert or Michael can chime in on this.

I am wondering if the following would work <@^#^@^# ... >

06-27-2008, 01:13 PM
There was another post a while ago concerning this that I found:


Unfortunately it came to the same conclusion is that the masked edit control does not provide the level of filter needed to limit this to strict alphanumeric characters [0-9][a-zA-Z]. Too bad they did not support regular expressions for a filter that would be the best type of implementation.

Brandon Lowe
06-27-2008, 01:14 PM
I normally write installs in installscript and can do most anything there but my company wants me to look at converting to MSI installs.
I know in installscript and can make the fields do what I want them to do.

06-27-2008, 01:16 PM
Well, with IS2009 and windows installer 4.5 support of the embedded UI you could use an InstallScript UI if that is acceptable to the company.

Brandon Lowe
06-27-2008, 03:19 PM
Where can I get info on the embedded UI stuff?
I have been closed into installscript for so long I feel like I'm new to installs when I start working with MSI and windows installer.

06-27-2008, 03:34 PM
For a start, please see "Using the InstallScript Engine as an External vs. Embedded UI Handler for InstallScript MSI Installations" in the InstallShield 2009 help.