how to add email adress validation code so the validation will dispaly after immideately entered email adress in text box of email adress

Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.BackColor = Color.White
        Dim temp As String
        temp = TextBox1.Text
        'Dim conditon As Boolean = False
        If emailaddresscheck(temp) = True Then
            ': If emailaddresscheck(conditon) = True Then
            TextBox1.BackColor = Color.Green
            'MessageBox.Show("Please enter your email address correctly", "Incorrect Email Entry")
            'TextBox1.Text = ""
            TextBox1.BackColor = Color.Yellow
        End If

    End Sub

I have stopped the message cause it will never allow to enter valid email unless you copy and paste.

Also try this pattern

Dim pattern As String = "\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"


@GarryHillton why do you post .NET code in a php thread? This is just spam...
On topic: you can use javascript to validate the email address immediatly.
This can be used to check if the email address is in a valid format ( )

If you need additional validation (checking that an email address is not already in use in your application, ..) you should use AJAX to connect back to the server and check this. You can either use raw AJAX but I advise you to use Jquery instead as it deals with the low level details of AJAX.

U need the latest jquery may be jquery-1.7.2.js

& validation library

and few codes in javascript

<script type='text/javascript'>


// Validation


 required:"Enter your email address",
 email:"Must be valid email address"},

'yourForm' is the id of your form...I have given u directions and almost 90% of script.....Rest is on your part to include proper error class and success class in the code above and proper css for the success and error class...try to learn jquery which makes good on page events....if you learn it you can even submit the form in the same page.

It's a great tutorial.every step has been expialned in a very simple way.Esay to be followed by anyone.

i m asking about how to write code in php to give a proper message of validation for email address after entered email adress text box

In php you can validate only if the form is submitted not after entering the text inside form...
Your question directed me towards jquery...

in php u can do it by

    echo "Email Field Empty!";
    if(!filter_var($_POST[email], FILTER_VALIDATE_EMAIL))
exit("Please Enter Valid Email id");

Above two Snippets will do it!

Please Post your question properly