C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




validation


Posted Date: 04 Aug 2008      Total Responses: 3

Posted By: hare ganesh       Member Level: Silver     Points: 1



how to do validation for alphanumeric values in textbox using keypress event in c#
windows application





Responses

Author: chandramohan    04 Aug 2008Member Level: GoldRating:     Points: 4

if e.KeyChar = " " then exit Sub
If Asc(e.KeyChar) < 48 Then
e.Handled = True
ElseIf Asc(e.KeyChar) > 57 And Asc(e.KeyChar) < 65 Then
e.Handled = True
ElseIf Asc(e.KeyChar) > 95 And Asc(e.KeyChar) < 97 Then
e.Handled = True
ElseIf Asc(e.KeyChar) > 122 Then
e.Handled = True
End If



Author: chandramohan    04 Aug 2008Member Level: GoldRating:     Points: 2

http://www.c-sharpcorner.com/UploadFile/scottlysle/UseErrorProvider03082007210138PM/UseErrorProvider.aspx


Author: UltimateRengan    04 Aug 2008Member Level: DiamondRating:     Points: 4

hi,
its working fine.i hope this may help u


private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{

if (((e.KeyChar < '0') || (e.KeyChar > '9')) && (e.KeyChar != '\b'))
{

}
else
{
e.Handled = true;
}

}


UltimateRengan
nathan.rengan@gmail.com
Trichy-Rider Group



Post Reply
You must Sign In to post a response.
Next : how to clear?
Previous : how to write the data on image file.
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use