MaskedTextBox and PromptChar

E

eljainc

Hello,

I am trying to utilize a MaskedTextBox control on my form. I would
like the user to enter numbers only (i.e. 65000), I set the Mask
property as 999999 and the PromptChar as space (it won't take a
blank). However in my output the masked characters are replaced by
spaces. How can I change this promptchar to a blank/empty value so
that there are no spaces? Is there a more suitable control to use?

Thanks
Mike
 
M

Mr. Arnold

eljainc said:
Hello,

I am trying to utilize a MaskedTextBox control on my form. I would
like the user to enter numbers only (i.e. 65000), I set the Mask
property as 999999 and the PromptChar as space (it won't take a
blank). However in my output the masked characters are replaced by
spaces. How can I change this promptchar to a blank/empty value so
that there are no spaces? Is there a more suitable control to use?

You can't use the MaskedTextBox.Text.Trim() or some other string
manipulation method for the control? You can even make-up a method like a
String method named RemoveSpacesMTB( ref MaskedTextBox ctrl), give the
method the MaskedTextBox control, do string manipulation that way too off of
ctrl.text.whateverstringmethod(), and return the manipulated string to the
control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top