Click here to Skip to main content
15,903,729 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all
I am working on vb.net windows base application where I have to add email address but it should allow all alphabets ,numbers and some special(not all) character, so I want to make a user define function for that. can any one please help me how to do that?
Posted

Try:
VB
Private Shared validData As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 @.-_"
Private Shared Function IsValid(c As Char) As Boolean
    Return validData.Contains(c)
End Function
Private Shared Function ContainsAllValid(s As String) As Boolean
	For Each c As Char In s
		If Not IsValid(c) Then
			Return False
		End If
	Next
	Return True
End Function
 
Share this answer
 
You should research Regular Expressions. Here[^] are some Code Project Articles that you can start with. This one[^] looks like exactly what you are looking for.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900