Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Imports System.Text.

RegularExpressions
Public Class Form2
Dim expMoileNo As New Regex("^(0|91)?[7-9][0-9]{9}$")
Dim expEmailId As New Regex("^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+$")
Dim expDate As New Regex("(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/]\d{4}")
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If (expMoileNo.IsMatch(TextBox1.Text.Trim())) Then
ErrorProvider1.SetError(TextBox1, "")
Else
ErrorProvider1.SetError(TextBox1, "Please enter valid mobile no")
End If
If (expEmailId.IsMatch(TextBox2.Text.Trim())) Then
ErrorProvider1.SetError(TextBox2, "")
Else
ErrorProvider1.SetError(TextBox2, "Please enter valid Email Id")
End If
If (expDate.IsMatch(TextBox3.Text.Trim())) Then
ErrorProvider1.SetError(TextBox3, "")
Else
ErrorProvider1.SetError(TextBox3, "Please enter valid Date")
End If
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Dim F1 As New Form1
F1.Show()
Me.Hide()
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


TextBox1.Text = ""
TextBox2.Text = ""
End Sub
End Class

You might also like