using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Net.Mail;
namespace regular_expression
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (!Regex.Match(textBox1.Text,"^[a-z -']+$").Success)
{
MessageBox.Show("Invalid name", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox1.Text = " ";
}
else
{
MessageBox.Show("Data added....");
}
try
{
var email = new MailAddress(textBox2.Text);
}
catch (Exception)
{
MessageBox.Show("Invalid Email", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox2.Text = " ";
}
}
}
}
12th class result
ReplyDelete