Вы находитесь на странице: 1из 3

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;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{

private void textBox2_Click(object sender, EventArgs e)


{
textBox2.Text = "";
}

private void textBox3_Click(object sender, EventArgs e)


{
textBox3.Text = "";
}

private void textBox4_Click(object sender, EventArgs e)


{
textBox4.Text = "";
}

private void textBox5_Click(object sender, EventArgs e)


{
textBox5.Text = "";
}

private void button2_Click(object sender, EventArgs e)


{
Form3 frm = new Form3();
frm.Show();
this.Hide();
}

private void panel1_Paint(object sender, PaintEventArgs e)


{

private void textBox5_TextChanged(object sender, EventArgs e)


{

private void textBox7_Click(object sender, EventArgs e)


{

textBox7.Text = "";
}

private void button1_Click(object sender, EventArgs e)


{
string email = @"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-
zA-Z]$";
bool isEmailValid = Regex.IsMatch(textBox3.Text, email);
string phone = @"^[6789]\d{9}$";
bool isPhoneValid = Regex.IsMatch(textBox2.Text, phone);

if (isEmailValid && isPhoneValid && comboBox1.Text!="")


{
if (textBox5.Text != null)
{
if (textBox5.Text== textBox7.Text)
{
MessageBox.Show("Signup succesfull");

MessageBox.Show(listBox1.Text);
textBox2.Text = "";
textBox3.Text = "";
textBox5.Text = "";
textBox7.Text = "";
label1.Text = "";
label2.Text = "";
textBox4.Text = "";
}
}
}
else
{
if(!isEmailValid)
{
if (textBox3.Text == null)
{
MessageBox.Show("email id not entered");
}
else
{
MessageBox.Show("Enter a valid email");
textBox3.Text = "";
}
}

if (!isPhoneValid)
{
if (textBox2.Text == null)
{
MessageBox.Show("Phone no not entered");
}
else
{
MessageBox.Show("Enter a valid phone number");
textBox2.Text = "";
}
}
if(textBox5.Text!=null)
{
if (textBox5.Text != textBox7.Text)
{
MessageBox.Show("invalid confirm password");

textBox7.Text = "";
textBox5.Text = "";
}
}

if (comboBox1.Text =="")
{
MessageBox.Show("Enter a country");

}
}

private void textBox4_TextChanged(object sender, EventArgs e)


{

private void textBox2_TextChanged(object sender, EventArgs e)


{
string phone = @"^[6789]\d{9}$";
bool isPhoneValid = Regex.IsMatch(textBox2.Text, phone);
if (isPhoneValid)
{
label1.Text = "";
label1.Text = "✓";
label1.BackColor = System.Drawing.Color.Green;
}
else
{
label1.Text = "";
label1.Text = "✗";
label1.BackColor = System.Drawing.Color.Red;
}
}

private void textBox3_TextChanged(object sender, EventArgs e)


{
string email = @"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-
zA-Z]$";
bool isEmailValid = Regex.IsMatch(textBox3.Text, email);
if(isEmailValid)
{
label2.Text = "";
label2.Text = "✓";
label2.BackColor = System.Drawing.Color.Green;
}
else
{
label2.Text = "";
label2.Text = "✗";
label2.BackColor = System.Drawing.Color.Red;
}
}

private void textBox7_TextChanged(object sender, EventArgs e)


{
if (textBox5.Text != textBox7.Text)
{
label5.Text = "";
label5.Text = "✗";
label5.BackColor = System.Drawing.Color.Red;
}
else
{
label5.Text = "";
label5.Text = "✓";
label5.BackColor = System.Drawing.Color.Green;
}
}

private void panel2_Paint(object sender, PaintEventArgs e)


{

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)


{

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{

private void label1_Click(object sender, EventArgs e)


{

private void comboBox1_Click(object sender, EventArgs e)


{
comboBox1.Text = "";
}

private void listBox1_Click(object sender, EventArgs e)


{
listBox1.Text = "";
}
}

Вам также может понравиться