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 !




Text Box Validation for allowing only alpha and special characters of @ and _ in VB.Net


Posted Date: 27 Sep 2007    Resource Type: Code Snippets    Category: Validations

Posted By: TSG Raghupathy       Member Level: Silver
Rating:     Points: 5



Hi,

The following code can be useful for validation of a text box which will only allow alphabetic letters and only two special characters of @ and _ (underscore mark). In VB.Net



Private Sub txtusr_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtusr.KeyPress
If (e.KeyChar >= Chr(32) And e.KeyChar <= Chr(63)) Or (e.KeyChar >= Chr(91) And e.KeyChar <= Chr(94)) Or (e.KeyChar = Chr(96)) Or (e.KeyChar >= Chr(123) And e.KeyChar <= Chr(126)) Then
e.Handled = True
End If
End Sub






Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Javascrip for Select All Checkbox
Previous Resource: Data Validation
Return to Discussion Resource Index
Post New Resource
Category: Validations


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use