Welcome Guest Search | Active Topics | Sign In | Register

MaskedEdit Options
cidesigns
Posted: Monday, October 8, 2012 4:57:38 PM
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?
eo_support
Posted: Monday, October 8, 2012 5:01:47 PM
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!
cidesigns
Posted: Monday, October 8, 2012 5:57:50 PM
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.
cidesigns
Posted: Monday, October 8, 2012 6:45:47 PM
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.
eo_support
Posted: Monday, October 8, 2012 7:00:57 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Great. Thanks for sharing! Glad that it works for you.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.