473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

textbox blank

How to check if user entered a simbol and not a blank in textBox?

Hrcko
Nov 17 '05 #1
2 1442
hi.

TextBox.Text.Length ?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Hrvoje Voda" <hr*********@luatech.com> wrote in message
news:d3**********@ss405.t-com.hr...
How to check if user entered a simbol and not a blank in textBox?

Hrcko

Nov 17 '05 #2
Hi Hrcko,

You can use the TextBox' KeyPress event and test the KeyChar property of
the KeyPressEventArgs.

if(Char.IsLetterOrDigit(e.KeyChar))
// valid alphanumeric character

To test for blank just compare against ' '.

To suppress unwanted characters set the KeyPressEventArgs.Handled property
to true.

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: TattyMane bigpond.net.au> | last post by:
asp.net, visual studio 2003, IE6 I have a sample web page that is linked to another page. On the first page, I have a text box, on the second, the first page's text box text is displayed using a...
2
by: NewToDotNet | last post by:
Hi, I am very new to ASP.NET and web programming in general. I have one issue. I have a Datagrid object with Edit template. In one Datagrid row, I have 1 DropdownList, 1 textbox and 1 readonly...
0
by: Scott | last post by:
I have a textbox to enter an email address followed by a password textbox. The email has a regularexpressionvalidator and a requiredfieldvalidator. The ReqField works fine, but if I put in an...
3
by: Dave | last post by:
I have a button that calls a JavaScript. I need to get the value in an asp:TextBox field to the javascript, either as a parameter or via some mechanism within the JavaScript itself. Any Ideas? ...
2
by: buran | last post by:
Dear ASP.NET Programmers, I have a question about a script I'm trying to code and invoke when a button (btnSave) is pressed on the page. This script should only run when a textbox (txtAD) on the...
1
by: jason | last post by:
I've seen a few posts on this issue, but no clear solutions. I have a mulitiline textbox inside a datagrid. I use TemplateColumn to define as multiline with 3 rows. I have other field types...
0
by: jrbrady | last post by:
When a user of my site presses a, say, button to move from one record to another, and the Page_Load event fires, all of the TextBox fields on the page are suddenly, and for no reason, blank. IOW,...
3
by: jrbrady | last post by:
I'm having a rather vexing problem with my VB.NET ASP.NET application: Briefly, on rare occasions, when a user of my site presses a button to move from one record to another, and the Page_Load...
0
by: Rick | last post by:
VS2005 Pro I'm binding to a custom business object with type Nullable(of date) and trying to validate user input. I have an error provider connected to the binding object which is connected...
7
by: adiel_g | last post by:
Hello Everyone, I created a custom control. On the CreateChildControls, I added a textbox to the control as follows: // TextBox TextBox txtValue = new TextBox(); txtValue.ID = "txtValue"; ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.