cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
loralynne
Level 6

Pasting into MaskedEdit control

I have a Basic MSI project. In my CustomerInformation dialog, I have a MaskedEdit control for the serial number, and I set the mask to

<^^^^=^^^^=^^^^>

If I copy 01234-56789-ABCDE to the clipboard and paste it into the MaskedEdit control, only the first section of it gets pasted. That is, only 01234 gets pasted into the control.

Is there a way I can paste a whole serial number into the MaskedEdit control so that all the fields of the control are filled out? We've had complaints about this for a long time, and marketing really wants to fix it.

Any help would be greatly appreciated.

Thanks,
loralynne
Labels (1)
0 Kudos

(2) Replies
MarkEarle
Level 6

loralynne,

The way I had to do something like this in the past is to detect the paste operation, remove the mask, allow the paste then reapply the mask. I noticed your mask had equal signs(=) but the paste had dashes(-). You will have to parse your buffer for any non-numeric characters then paste the parsed string to the field and apply the mask.

This is not an easy or straight forward fix. You may want to use a textbox and write your own code for validation instead.

Cheers,

ME
0 Kudos
loralynne
Level 6

Thanks for your reply ME! I was hoping there would be a easy straightforward fix. Oh well. 😞

FYI - The = is actually the field terminator. From http://msdn2.microsoft.com/en-us/library/aa369797.aspx: "This must follow a #, %, ^, or `. This creates one more input position of the same type as the preceding positions and terminates the field with a '-' separator."

Thanks again,
loralynne
0 Kudos