TextBox Question

  • Thread starter Thread starter Jeff Williams
  • Start date Start date
J

Jeff Williams

Is there a way I can place a Mask on a TextBox input so that say only
numbers from 0 to 9 can be entered.

Regards
Jeff
 
Hello Jeff,

There is no standard way for this. You need to customize your textbox.
See sample there http://www.codeproject.com/cs/miscctrl/maskedcsedit.asp

JW> Is there a way I can place a Mask on a TextBox input so that say
JW> only numbers from 0 to 9 can be entered.
JW>
JW> Regards
JW> Jeff

---
WBR, Michael Nemtsev [C# MVP] blog: http://spaces.live.com/laflour
team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
 
Jeff,

You could also use regex validation. Check this artivle:
http://www.codeproject.com/managedcpp/YuvalidatingTextBox.asp

Thanks,


John
--------------------
From: Jeff Williams <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.csharp
Subject: TextBox Question
Date: Mon, 29 Jan 2007 07:06:53 +1000
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <[email protected]>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060910 SeaMonkey/1.0.5
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: (e-mail address removed)
Lines: 5
Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTFEEDS01.phx.gbl!tornado.f
astwebnet.it!tiscali!newsfeed1.ip.tiscali.net!news.tiscali.de!newsfeed.freen
et.de!feeder.news-service.com!194.186.254.21.MISMATCH!newsfeed.gamma.ru!Gamm
a.RU!news3.cnt.ru!mtu.ru!sn-xt-sjc-05!sn-xt-sjc-06!sn-post-sjc-01!supernews.
com!corp.supernews.com!not-for-mail
Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.languages.csharp:11416
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Is there a way I can place a Mask on a TextBox input so that say only
numbers from 0 to 9 can be entered.

Regards
Jeff

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fprq2\fcharset0
MS Sans Serif;}{\f1\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2500;}\viewkind4\uc1\pard\f0\fs20 Cheers,\par
\par
johnKn [MS-SDK]\par
\par
\par
\par
-Please do not send email directly to this alias. This alias is for \par
newsgroup purposes only\par
\par
-This posting is provided "AS IS" with no warranties, and confers no
rights.\par
\par
-To provide additional feedback about your community experience please send
\par
e-mail to: (e-mail address removed)\par
\f1\par
}
 
Jeff,

I am sorry I sent the wrong url. This is the proper one for C#:
http://www.codeproject.com/useritems/Validation.asp

Thanks,

John
--------------------
From: Jeff Williams <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.csharp
Subject: TextBox Question
Date: Mon, 29 Jan 2007 07:06:53 +1000
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <[email protected]>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060910 SeaMonkey/1.0.5
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: (e-mail address removed)
Lines: 5
Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTFEEDS01.phx.gbl!tornado.f
astwebnet.it!tiscali!newsfeed1.ip.tiscali.net!news.tiscali.de!newsfeed.freen
et.de!feeder.news-service.com!194.186.254.21.MISMATCH!newsfeed.gamma.ru!Gamm
a.RU!news3.cnt.ru!mtu.ru!sn-xt-sjc-05!sn-xt-sjc-06!sn-post-sjc-01!supernews.
com!corp.supernews.com!not-for-mail
Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.languages.csharp:11416
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Is there a way I can place a Mask on a TextBox input so that say only
numbers from 0 to 9 can be entered.

Regards
Jeff

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fprq2\fcharset0
MS Sans Serif;}{\f1\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2500;}\viewkind4\uc1\pard\f0\fs20 Cheers,\par
\par
johnKn [MS-SDK]\par
\par
\par
\par
-Please do not send email directly to this alias. This alias is for \par
newsgroup purposes only\par
\par
-This posting is provided "AS IS" with no warranties, and confers no
rights.\par
\par
-To provide additional feedback about your community experience please send
\par
e-mail to: (e-mail address removed)\par
\f1\par
}
 
Back
Top