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 !




How to validate an IP address from 1.0.0.0 to 255.255.255.255


Posted Date: 03 May 2008    Resource Type: Code Snippets    Category: Validations

Posted By: Rekha        Member Level: Gold
Rating:     Points: 0



The following code sample will help in validating an ip address
Public Function ValidIP(ByVal addr As String) As Boolean
'create our match pattern
Dim pat As String = "^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\." & _
"([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$"
Dim check As New Text.RegularExpressions.Regex(pat)
'boolean variable to hold the status
Dim valid As Boolean = False
If addr = "" Then
valid = False
Else
valid = check.IsMatch(addr, 0)
End If
'return the results
Return valid
End Function




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: Validating a textbox to enter only numerics and no special characters or characters
Previous Resource: How to validate an email address
Return to Discussion Resource Index
Post New Resource
Category: Validations


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

silicone halloween masks

Contact Us    Privacy Policy    Terms Of Use