You are on page 1of 7

FORM1

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.Collections;

using static System.Windows.Forms.VisualStyles.VisualStyleElement;

using static System.Windows.Forms.DataFormats;

using System.Security.Cryptography.X509Certificates;

namespace StudentClass

public partial class Form1 : Form

public Form1()

InitializeComponent();

private void textBox8_TextChanged(object sender, EventArgs e)

}
private void textBox7_TextChanged(object sender, EventArgs e)

private void button1_Click(object sender, EventArgs e)

StudentInfoClass.StudentNo = long.Parse(textBox1.Text);

StudentInfoClass.Program = comboBox1.Text.ToString();

StudentInfoClass.LastName = textBox2.Text.ToString();

StudentInfoClass.Firstname = textBox3.Text.ToString();

StudentInfoClass.MiddleName = textBox4.Text.ToString();

StudentInfoClass.Age = long.Parse(textBox5.Text.ToString());

StudentInfoClass.ContactNo = long.Parse(textBox6.Text.ToString());

StudentInfoClass.Address = textBox7.Text.ToString();

Form2 frm = new Form2();

DialogResult trees = new DialogResult();

trees = frm.ShowDialog();

if (trees == DialogResult.OK)

comboBox1.SelectedIndex = 0;

textBox3.Text = " "; textBox2.Text = " "; textBox4.Text = " "; textBox7.Text = " ";

textBox5.Text = " "; textBox1.Text = ""; textBox6.Text = " ";

private void Form1_Load(object sender, EventArgs e)


{

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)

---------------------------------------------------------------------------------------------------

FORM2

namespace StudentClass

public partial class Form2 : Form

private DelegateNumber DelNumAge, DelNumContactNo, DelStudNo;

private DelegateText DelProgram, DelLastName, DelFirstName, DelMiddleName, DelAddress;

public Form2()

InitializeComponent();

private void Form2_Load(object sender, EventArgs e)

DelStudNo = new DelegateNumber(StudentInfoClass.GetStudentNo);


DelProgram = new DelegateText(StudentInfoClass.GetProgram);

DelLastName = new DelegateText(StudentInfoClass.GetLastName);

DelFirstName = new DelegateText(StudentInfoClass.GetFirstName);

DelMiddleName = new DelegateText(StudentInfoClass.GetMiddleName);

DelNumAge = new DelegateNumber(StudentInfoClass.GetAge);

DelNumContactNo = new DelegateNumber(StudentInfoClass.GetContactNo);

DelAddress = new DelegateText(StudentInfoClass.GetAddress);

label2.Text = DelStudNo(StudentInfoClass.StudentNo).ToString();

label4.Text = DelProgram(StudentInfoClass.Program);

label6.Text = DelLastName(StudentInfoClass.LastName);

label8.Text = DelFirstName(StudentInfoClass.Firstname);

label10.Text = DelMiddleName(StudentInfoClass.MiddleName);

label12.Text = DelNumAge(StudentInfoClass.Age).ToString();

label14.Text = DelNumContactNo(StudentInfoClass.ContactNo).ToString();

label16.Text = DelAddress(StudentInfoClass.Address);

private void button1_Click(object sender, EventArgs e)

this.DialogResult = DialogResult.OK;

this.Close();

private void label2_Click(object sender, EventArgs e)

}
}

----------------------------------------------------------------------------------------------------------------

CLASS1

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace StudentClass

public delegate long DelegateNumber(long number);

public delegate string DelegateText(string txt);

internal class StudentInfoClass

public static string Firstname = " ";

public static string LastName = " ";

public static string MiddleName = " ";

public static string Address = " ";

public static string Program = " ";

public static long Age = 0;

public static long ContactNo = 0;

public static long StudentNo = 0;

public static string GetFirstName(string firstName)

return firstName;

public static string GetLastName(string lastName)


{

return lastName;

public static string GetMiddleName(string middleName)

return middleName;

public static string GetAddress(string address)

return address;

public static string GetProgram(string program)

return program;

public static long GetAge(long age)

return age;

public static long GetContactNo(long contactNo)

return contactNo;

public static long GetStudentNo(long studentNo)

return studentNo;

You might also like