One option that I suspect you considered and rejected is just use a regular
textbox, do not give the user a 'mask' but instead place a label control
where it makes best sense on your form with an example of the input pattern
you expect. Naturally 99 out of 100 users will screw this up, I would trap
a key event for the textbox and compare it with what I want as user goes
along. Are we trying to block 'illegal' characters here or are we after a
very specific pattern? Another option would be several boxes and collect
the desired information and format it with code in your program. Again I'm
sure you have already considered and rejected these, but seemed like
something to toss out anyway.
> -----Original Message-----
> From: Discussion forum for developers using Windows Forms to
> build apps and controls
> [mailto:DOTNET-WINFORMS@DISC...] On Behalf Of
> Bhatnagar, Amit
> Sent: Wednesday, February 06, 2008 10:57 AM
> To: DOTNET-WINFORMS@DISC... > Subject: [DOTNET-WINFORMS] Prompt characters in a MaskedTextBox
> I have the need to create a customized text entry box that
> can accept various types of geographic coordinates. The problem
> The MaskedTextBox only allows a single prompt character to be
> displayed upon user input. I need the ability to display
> different prompt characters for certain character positions.
> How can I do this? Also, due to the nature of the text being
> inputted, I suspect that I will need to use a regex to
> validate this properly. So I'm assuming because of these two
> limitations, that the MaskedTextBox isn't the way to go.
> Does anyone have any suggestions on how I can go about this?
> Use a regular text box and validate against a reg expression?
> But how do I handle displaying the custom prompt characters?
> The information contained in this e-mail message is PRIVATE.
> It may contain confidential information and may be legally
> privileged. It is intended for the exclusive use of the
> addressee(s). If you are not the intended recipient, you are
> hereby notified that any dissemination, distribution or
> reproduction of this communication is strictly prohibited. If
> the intended recipient(s) cannot be reached or if a
> transmission problem has occurred, please notify the sender
> immediately by return e-mail and destroy all copies of this message.
> Thank you.