Validation Block

Posted on 2011-03-08
Last Modified: 2012-05-11
I am using the Microsoft Validation  Block.   I am using the code below to check that the webpage is valid.  But I only want to check this if a user enters a web page.

<Bindable(True)> _
    <RegexValidator("(http://|)(www\.)?([^\.]+)\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))", MessageTemplate:="Please enter a valdi webpage")>
      Public Property WebPage() As String
            Return Me.M_WebPage
        End Get
        Set(ByVal Value As String)
            Me.M_WebPage = Value
        End Set
    End Property

Open in new window

Question by:Kevin Robinson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 35114094
So bind this regex to a text field where the user enters a web page address. Then you'll be able to see if the address is valid.

Author Comment

by:Kevin Robinson
ID: 35126933
Sorry I should have worded my question better.   I want to validate the web page ONLY if there is one entered.  I.e  a blank field is also OK.
LVL 83

Accepted Solution

CodeCruiser earned 500 total points
ID: 35177089

Author Closing Comment

by:Kevin Robinson
ID: 35180151

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question