Solved

Validation Block

Posted on 2011-03-08
4
204 Views
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
        Get
            Return Me.M_WebPage
        End Get
        Set(ByVal Value As String)
            Me.M_WebPage = Value
        End Set
    End Property

Open in new window

0
Comment
Question by:Kevin Robinson
  • 2
4 Comments
 
LVL 3

Expert Comment

by:Epitel0920
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.
0
 
LVL 3

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.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 35177089
0
 
LVL 3

Author Closing Comment

by:Kevin Robinson
ID: 35180151
Sweet!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

756 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