AIM: - Develop Windows Application in C# to perform all the validations without using any validator.
FORM 1 using using using using using using using using using using using System; [Link]; [Link]; [Link]; [Link]; [Link]; [Link]; [Link]; [Link]; [Link]; [Link];
namespace WindowsFormsApplication2 { public partial class Form1 : Form { public string str1, str2, str3; public int age, dob, dob1, dob2; public Form1() { InitializeComponent(); } private void btnvalidate_Click(object sender, EventArgs e) { try { str1 = [Link]; str2 = [Link]; str3 = [Link]; age = Convert.ToInt32([Link]); dob = Convert.ToInt32([Link]); dob1 = Convert.ToInt32([Link]); dob2 = Convert.ToInt32([Link]); if ([Link] != [Link]) { [Link](); [Link] = "Name and User Name Must Be Same!!!!"; return; } int n = [Link]([Link]()); if (n < 1 || n > 100) { [Link]("Age must be in the range of 1 to 100"); [Link]();
[Link] = "Input Age must be in the Range of 1 to 100!!!"; } else { [Link](); } [Link]("Registration Completed!!!!!"); [Link](); Form2 obj = new Form2(str1, str2, age, str3, dob, dob1, dob2); [Link](); } catch (Exception ex) { [Link]([Link]); } }
private void requiredfieldvalidator_KeyPress(object sender, KeyPressEventArgs e) { // 97 to 122 is for a to z ///32 for blank space /// 48 to 57 is for numeric values /// 8 is for back space if (((int)[Link] >= 65 && (int)[Link] <= 90) || ((int)[Link] >= 97 && (int)[Link] <= 122) || ((int)[Link]) == 8 || ((int)[Link]) == 32) { [Link] = false; } else { [Link]("Please Enter Alphabets Only!!"); [Link] = true; } } private void comparevalidator_KeyPress(object sender, KeyPressEventArgs e) { if (((int)[Link] >= 65 && (int)[Link] <= 90) || ((int)[Link] >= 97 && (int)[Link] <= 122) || ((int)[Link]) == 8 || ((int)[Link]) == 32) { [Link] = false; } else { [Link]("Please Enter Alphabets Only!!"); [Link] = true; } } private void requiredfieldvalidator_Validating(object sender, CancelEventArgs e)
{ if ([Link] == "") { TextBox textbox = sender as TextBox; [Link] = [Link]([Link]); [Link](textbox, "Textbox cannot be empty"); [Link](); [Link] = "Name Cannot Be Empty!!!"; } else { [Link](); [Link](); } } private void Form1_Load(object sender, EventArgs e) { [Link](); [Link](); [Link](); [Link](); [Link](); } private void comparevalidator_Validating(object sender, CancelEventArgs e) { if ([Link] == "") { TextBox textbox = sender as TextBox; [Link] = [Link]([Link]); [Link](textbox, "Textbox cannot be empty"); [Link](); [Link] = " User Name Cannot Be Empty!!!"; } else { [Link](); [Link](); } } private void rangevalidator_KeyPress(object sender, KeyPressEventArgs e) { if ( && ) { [Link] = true; [Link]("Please Enter Only Numbers!!!!"); } } private void regularexpvalidator_Validating(object sender, CancelEventArgs e)
{ if ([Link] == "") { [Link](); [Link] = "E-mail ID can't be blank!!!!"; [Link](regularexpvalidator,"Can't be blank"); } else { [Link](); [Link](); [Link] rEMail = new [Link](@"^[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]$"); if ([Link] > 0) { if () { [Link]("E-Mail expected", "Error", [Link], [Link]); [Link](); [Link](); [Link] = "Please Enter Valid E-mail ID"; [Link] = true; } } } } private void customvalidator_KeyPress(object sender, KeyPressEventArgs e) { if ( &&  ) { [Link] = true; [Link]("Please Enter Only Numbers!!!!"); } } private void textBox2_KeyPress(object sender, KeyPressEventArgs e) { if ( &&  ) { [Link] = true; [Link]("Please Enter Only Numbers!!!!"); } } private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if ( &&  ) { [Link] = true;
[Link]("Please Enter Only Numbers!!!!"); } } private void rangevalidator_Validating(object sender, CancelEventArgs e) { if ([Link] == "") { [Link](); [Link] = "Please Enter Age"; [Link](rangevalidator, "Please Enter Age"); } else { [Link](); [Link](); } } } } FORM 2 using using using using using using using using System; [Link]; [Link]; [Link]; [Link]; [Link]; [Link]; [Link];
namespace WindowsFormsApplication2 { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private string name1, dname1,email1; int age1, dobb, dobb1, dobb2; public Form2(string name,string dname,int age,string email,int dob,int dob1,int dob2) { InitializeComponent(); this.name1 = name; this.dname1= dname; this.age1 = age; this.email1= email; [Link] = dob; this.dobb1 = dob1;
this.dobb2=dob2; } private void Form2_Load(object sender, EventArgs e) { [Link] = this.name1; [Link] = this.dname1; [Link] = [Link](); [Link] = this.email1; [Link] = [Link]() + "/"+ [Link]() +"/"+ [Link](); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { [Link](); } } }