



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This C# code outlines an Admission Form application with a user interface that includes lists of departments and programs, text boxes for entering application numbers and marks, and buttons for displaying merit and results. The application checks the validity of user selections and calculates merit based on obtained and total marks.
Typology: Assignments
1 / 6
This page cannot be seen from the preview
Don't miss anything!




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; namespace AdmissionForm { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { listDepart.Items.Add("Computer Science"); listDepart.Items.Add("Information Technology"); listDepart.Items.Add("TeleCommunication"); listProg.Items.Add("BSCS"); listProg.Items.Add("MCS"); listProg.Items.Add("MIT"); listProg.Items.Add("BS(TS)"); applicationNo.Enabled = false; name.Enabled = false; matricObMarks.Enabled = false; matricToMarks.Enabled = false; fscObMarks.Enabled = false; fscToMarks.Enabled = false; bscObMarks.Enabled = false; bscToMarks.Enabled = false; }
private void listProg_SelectedIndexChanged(object sender, EventArgs e) { if (listDepart.SelectedIndex == -1) { MessageBox.Show("Please First Select The Department"); } else if (listDepart.SelectedIndex == 0 && listProg.SelectedIndex == 0) { MessageBox.Show("Enter The Data"); applicationNo.Enabled = true; name.Enabled = true; fscObMarks.Enabled = true; fscToMarks.Enabled = true; bscObMarks.Enabled = false; bscToMarks.Enabled = false; matricObMarks.Enabled = false; matricToMarks.Enabled = false; } else if (listDepart.SelectedIndex == 0 && listProg.SelectedIndex == 1) { MessageBox.Show("Enter The Data"); applicationNo.Enabled = true; name.Enabled = true; matricObMarks.Enabled = true; matricToMarks.Enabled = true; fscObMarks.Enabled = true; fscToMarks.Enabled = true; bscObMarks.Enabled = true; bscToMarks.Enabled = true; } else if (listDepart.SelectedIndex == 1 && listProg.SelectedIndex == 2) { MessageBox.Show("Enter The Data"); applicationNo.Enabled = true; name.Enabled = true; matricObMarks.Enabled = true; matricToMarks.Enabled = true; fscObMarks.Enabled = true; fscToMarks.Enabled = true; bscObMarks.Enabled = true; bscToMarks.Enabled = true; }
else if ((listDepart.SelectedIndex == 0 && listProg.SelectedIndex == 1) || (listDepart.SelectedIndex == 1 && listProg.SelectedIndex == 2)) { double matricObtainMarks, matricTotalMarks, fscObtainMarks, fscTotalMarks, bscObtainMarks, bscTotalMarks,totalobtain; matricObtainMarks = Convert.ToDouble(matricObMarks.Text); matricTotalMarks = Convert.ToDouble(matricToMarks.Text); fscObtainMarks = Convert.ToDouble(fscObMarks.Text); fscTotalMarks = Convert.ToDouble(fscToMarks.Text); bscObtainMarks = Convert.ToDouble(bscObMarks.Text); bscTotalMarks = Convert.ToDouble(bscToMarks.Text); totalobtain = matricObtainMarks + fscObtainMarks + bscObtainMarks; double total = matricTotalMarks + fscTotalMarks + bscTotalMarks; if ((matricObtainMarks <= matricTotalMarks) && (fscObtainMarks <= fscTotalMarks) && (bscObtainMarks <= bscTotalMarks)) { double meritPer; meritPer = (totalobtain / total) * 100; merit.Text = meritPer.ToString("#.0"); if (meritPer >= 80) { remarks.Text = "Congratulation...!"; } else { remarks.Text = "See Next Merit list"; } } else { MessageBox.Show("ERROR:Obtain marks are greater then Total Marks"); } } } private void btnClear_Click(object sender, EventArgs e) {
applicationNo.Clear(); name.Clear(); matricObMarks.Clear(); matricToMarks.Clear(); fscObMarks.Clear(); fscToMarks.Clear(); bscObMarks.Clear(); bscToMarks.Clear(); merit.Clear(); remarks.Clear(); listDepart.SelectedIndex = -1; listProg.SelectedIndex = -1; applicationNo.Enabled = false; name.Enabled = false; matricObMarks.Enabled = false; matricToMarks.Enabled = false; fscObMarks.Enabled = false; fscToMarks.Enabled = false; bscObMarks.Enabled = false; bscToMarks.Enabled = false; } private void btnExit_Click(object sender, EventArgs e) { Application.Exit(); } } }