Tutorials
Forum
Resources
Reviews
Jobs
Interview
Videos
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Polls
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Lobby
|
Gift Shop
|
Online Members
Sankar
Sunitha
Ashokkumar
Anu George
chanti
Falguni
Prachi Kulkarni
cloud
Prasad kulkarni
Gokula
Prabu Thangavelu
More...
Resources
»
Code Snippets
»
C# Syntax
Textbox validation - Allows Only Alpha-Numeric’s (C# Win Forms)
Posted Date:
12-Dec-2008
Category:
C# Syntax
Rating:
Author:
KR
Member Level:
Gold
Points
: 8 (
Rs
8)
The following steps allows the user to enter only Alpha-Numeric’s (0 to 9/a to z/ A to Z),
-> Drag and drop textbox from toolbox to form
-> Register Textbox KeyPressEvent
Code:
--------
Using System;
using System.Windows.Forms;
using System.Text;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
// Textbox KeyPress event block
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
// Allows only Alpha-Numeric’s
if (!(Char.IsLetter(e.KeyChar) || Char.IsDigit(e.KeyChar) || Char.IsControl (e.KeyChar)))
e.Handled = true;
}
}
}
Did you like this resource? Share it with your friends and show your love!
Tweet
Share
Responses to "Textbox validation - Allows Only Alpha-Numeric’s (C# Win Forms)"
Author:
Miss Meetu Choudhary
10 Apr 2009
Member Level:
Gold
Points
: 1
For description
Please Describe your code as well to make it more efficient we respect your contributions.
And it will be of great help to viewers if they are well described.
Thanks and Regards
Meetu Choudhary
Editor
Feedbacks
Post Comment:
Notify me by email when others post comments to this article.
Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
No HTML formatting and links to other web sites are allowed.
This is a strictly moderated site. Absolutely no spam allowed.
Name:
Sign In
to fill automatically.
Email:
(Will not be published, but
required
to validate comment)
Type the numbers and letters shown on the left.
Next Resource:
Textbox validation - Allows Only Letters
Previous Resource:
Simple code to make data table
Return to Resources
Post New Resource
Category:
C# Syntax
Post resources and
earn money
!
More Resources
Textbox validation - Allows Only Letters
Inserting image into database & retriving from database.
Types of Assemblies in C#
function with more than one return value
Difference between Call by value & Call by reference
Textbox validation - Allows Numeric’s (0 to 9) Only (C# Win Forms)
Popular Tags
Tag posting guidelines
Search Tags
Textbox Validation
.
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Asheej T K
(85)
Ajatshatru Upa...
(48)
Pawan Awasthi
(31)
Last 7 Days
Asheej T K
(327)
Paritosh Mohap...
(289)
Ajatshatru Upa...
(253)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds
About Us
Trademark Disclaimer
Contact Us
Copyright
Privacy Policy
Terms Of Use
Revenue Sharing sites
Advertise
Talk to
Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.