|
Rank: Newbie Groups: Member
Joined: 10/7/2012 Posts: 7
|
I am using a MaskedEdit for my Zip Code and Phone Numbers. I have complete zip codes and phone numbers in my database. For some reason the MaskedEdit does not show my numbers correctly. For instance, I have a phone number that is 834 8934893, it displays in the MaskedEdit as (34_) 348-3___. The zip code I have is 729569834 and it displays in the MakedEdit as 72956-834_. It seems to be skipping and shifting numbers. I have also put in the phone number and zip code exactly as it apears in my database. Can you help?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
I believe you will need to format the text exactly as it appears in MaskedEdit in order for it to accept it. For example, you would need to write code to format your phone number "838 8934893" to "(838) 893-4893" before passing it to the MaskedEdit. The MaskedEdit doesn't really know it is a phone number so it just tries to match it literally. Likewise, when it gives the content back to you, it would give it in the "(838) 893-4893" format. It does not remove any delimiters.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 10/7/2012 Posts: 7
|
eo_support wrote:Hi,
I believe you will need to format the text exactly as it appears in MaskedEdit in order for it to accept it. For example, you would need to write code to format your phone number "838 8934893" to "(838) 893-4893" before passing it to the MaskedEdit. The MaskedEdit doesn't really know it is a phone number so it just tries to match it literally. Likewise, when it gives the content back to you, it would give it in the "(838) 893-4893" format. It does not remove any delimiters.
Thanks! Ok, thank you! I will give that a try.
|
|
Rank: Newbie Groups: Member
Joined: 10/7/2012 Posts: 7
|
cidesigns wrote:eo_support wrote:Hi,
I believe you will need to format the text exactly as it appears in MaskedEdit in order for it to accept it. For example, you would need to write code to format your phone number "838 8934893" to "(838) 893-4893" before passing it to the MaskedEdit. The MaskedEdit doesn't really know it is a phone number so it just tries to match it literally. Likewise, when it gives the content back to you, it would give it in the "(838) 893-4893" format. It does not remove any delimiters.
Thanks! Ok, thank you! I will give that a try. You are genius! That works! Thank you! For those who may need to know in the future I used Phone = String.Format("{0:(###) ###-####}", Long.Parse(VenConPhone)) Your phone number cannot have spaces in it when it comes from the database. VenConPhone is my variable that holds the value brought in from the database and of course Phone is what I will make my textbox.Text = Phone.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Great. Thanks for sharing! Glad that it works for you.
|
|