To the OP
Hi,
the first paragraph should be include a welcome phrase (also a nice grace in virtual world,not only in real life).
It's not a grace to post your code only, what would you say to us with this?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace POIA
{
public partial class Registration : Form
{
public Registration()
{
InitializeComponent();
}
private void Registration_Load(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void label10_Click(object sender, EventArgs e)
{
}
private void pictureBox2_Click(object sender, EventArgs e)
{
}
private void textBox6_TextChanged(object sender, EventArgs e)
{
if (textBox6.Text == "")
{
MessageBox.Show("Enter the user id");
textBox6.Clear();
textBox6.Focus();
}
if (!Regex.IsMatch(textBox6.Text, "[0-9]+$"))
{
MessageBox.Show("Enter integers only");
textBox6.Clear();
textBox6.Focus();
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "" || textBox7.Text == "" || textBox8.Text == "" || richTextBox1.Text == "" )
{
MessageBox.Show("Enter the Details..!! ");
}
else
{
try
{
POIA.BLL.RegistrationFormBLL ro = new POIA.BLL.RegistrationFormBLL();
ro.firstname = textBox1.Text;
ro.lastname = textBox2.Text;
ro.gender = comboBox3.Text;
ro.dateofbirth =(dateTimePicker1.Value);
ro.address = richTextBox1.Text;
ro.phonenumber = textBox3.Text;
ro.annualincome = textBox4.Text;
ro.emailid = textBox5.Text;
ro.policyname = comboBox1.Text;
ro.userId = textBox6.Text;
ro.password = textBox7.Text;
ro.securityquestion = comboBox2.Text;
ro.securityanswer = textBox8.Text;
ro.RegistrationM();
MessageBox.Show("Registration Successful..!!");
}
catch (Exception e1)
{
MessageBox.Show(e1.Message, "Error..!!");
}
}
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (!Regex.IsMatch(textBox1.Text, "[a-z A-Z]+$"))
{
MessageBox.Show("Enter alphabets only");
textBox1.Clear();
textBox1.Focus();
}
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
if (!Regex.IsMatch(textBox2.Text, "[a-z A-Z]+$"))
{
MessageBox.Show("Enter alphabets only");
textBox2.Clear();
textBox2.Focus();
}
}
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox3.Text == "")
{
MessageBox.Show("Select any one option");
}
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
if (richTextBox1.Text == "")
{
MessageBox.Show("Enter address");
richTextBox1.Clear();
richTextBox1.Focus();
}
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
if (!Regex.IsMatch(textBox3.Text, "[0-9]+$"))
{
MessageBox.Show("Enter integers only");
textBox3.Clear();
textBox3.Focus();
}
else if (textBox3.Text.Length > 10)
{
MessageBox.Show("Enter 10 numbers only");
textBox3.Clear();
textBox3.Focus();
}
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
if (!Regex.IsMatch(textBox4.Text, "[0-9]+$"))
{
MessageBox.Show("Enter integers only");
textBox4.Clear();
textBox4.Focus();
}
}
private void textBox5_TextChanged(object sender, EventArgs e)
{
if (!Regex.IsMatch(textBox5.Text, "[0-9 a-z _ @]+$"))
{
MessageBox.Show("Only 0-9,uppercase letters, lowercase letters, _ and @ are allowed");
textBox5.Clear();
textBox5.Focus();
}
}
private void textBox7_TextChanged(object sender, EventArgs e)
{
if (textBox7.Text.Length > 8)
{
MessageBox.Show("Password should be exactly 8 characters");
textBox7.Clear();
textBox7.Focus();
}
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void textBox8_TextChanged(object sender, EventArgs e)
{
if (!Regex.IsMatch(textBox8.Text, "[a-z A-Z]+$"))
{
MessageBox.Show("Enter Alphabets Only");
textBox8.Clear();
textBox8.Focus();
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
textBox6.Clear();
textBox7.Clear();
textBox8.Clear();
richTextBox1.Clear();
}
}
}
Normally here should be your question ("why does it throw this exception i.e ?") and a
Regards would be also nice.
Regards