I have a txtPhone that I need to format like 555-555-5555 and when a user
inputs numbers it should only take numbers.

RE: Formatting txtPhone by SoorajPM

SoorajPM
Sun Oct 17 01:21:01 CDT 2004

Hi

You mean the text box should display the characters like that? If yes, You
can use the ToString method by giving txtPhone.Text =
MyPhoneNumber.ToString("###-###-####"). While saving replace the "-"
character with null.

Sooraj
Microsoft Community Star

"Dave" wrote:

> I have a txtPhone that I need to format like 555-555-5555 and when a user
> inputs numbers it should only take numbers.

Re: Formatting txtPhone by Herfried

Herfried
Sun Oct 17 05:58:55 CDT 2004

"Dave" <Dave@discussions.microsoft.com> schrieb:
> I have a txtPhone that I need to format like 555-555-5555
> and when a user inputs numbers it should only take numbers.

<URL:http://www.codeproject.com/cs/miscctrl/maskedcsedit.asp>
<URL:http://www.codeproject.com/vb/net/maskedbox_control.asp>
<URL:http://www.codeproject.com/vb/net/validtext3.asp>
<URL:http://www.codeproject.com/vb/net/cpflexmaskeditbox.asp>
<URL:http://www.codeproject.com/useritems/ValidText.asp>
...

.NET 2.0 will include a masked edit control.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>



RE: Formatting txtPhone by Dave

Dave
Sun Oct 17 16:55:01 CDT 2004

How do I do that?

"Sooraj PM" wrote:

> Hi
>
> You mean the text box should display the characters like that? If yes, You
> can use the ToString method by giving txtPhone.Text =
> MyPhoneNumber.ToString("###-###-####"). While saving replace the "-"
> character with null.
>
> Sooraj
> Microsoft Community Star
>
> "Dave" wrote:
>
> > I have a txtPhone that I need to format like 555-555-5555 and when a user
> > inputs numbers it should only take numbers.