SkyRanger Posted September 4, 2020 Share Posted September 4, 2020 Trying to figure out how to verify if email is an email. txtEMAIL.Text Imports System.Text.RegularExpressions Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If txtFULLNAME.Text = "" Then Form6.Show() Form6.Label1.Text = "You must enter your Full Name" ElseIf txtEMAIL.Text = "" Then Form6.Show() Form6.Label1.Text = "You must enter your Email Address" Else Form5.Show() Form2.txtFULLNAME.Text = txtFULLNAME.Text Form3.txtFULLNAME.Text = txtFULLNAME.Text Form4.txtFULLNAME.Text = txtFULLNAME.Text Form5.txtFULLNAME.Text = txtFULLNAME.Text Form2.txtEMAIL.Text = txtEMAIL.Text Form3.txtEMAIL.Text = txtEMAIL.Text Form4.txtEMAIL.Text = txtEMAIL.Text Me.Hide() End If End Sub Trying to figure out how to insert the Regex in to what is above to have it work properly Dim par As String par="^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$" If Regex.IsMatch(txtEMAIL.Text, par) Then 'do nothing and continue' Else Form6.Show() Form6.Label1.Text = "You must enter a proper Email Address" End If Quote Link to comment https://forums.phpfreaks.com/topic/311428-vb-need-help-with-email-verify/ Share on other sites More sharing options...
SkyRanger Posted September 4, 2020 Author Share Posted September 4, 2020 After scratching my head and staring at it for a bit. Figured it out. Need to verify a proper email is entered before continuing. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim par As String par = "^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$" If Regex.IsMatch(txtEMAIL.Text, par) Then If txtFULLNAME.Text = "" Then Form6.Show() Form6.Label1.Text = "You must enter your Full Name" ElseIf txtEMAIL.Text = "" Then Form6.Show() Form6.Label1.Text = "You must enter your Email Address" Else Form5.Show() Form2.txtFULLNAME.Text = txtFULLNAME.Text Form3.txtFULLNAME.Text = txtFULLNAME.Text Form4.txtFULLNAME.Text = txtFULLNAME.Text Form5.txtFULLNAME.Text = txtFULLNAME.Text Form2.txtEMAIL.Text = txtEMAIL.Text Form3.txtEMAIL.Text = txtEMAIL.Text Form4.txtEMAIL.Text = txtEMAIL.Text Me.Hide() End If Else Form6.Show() Form6.Label1.Text = "You must enter a proper Email Address" End If End Sub Quote Link to comment https://forums.phpfreaks.com/topic/311428-vb-need-help-with-email-verify/#findComment-1581140 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.