In this articles, I am using Listbox ,radio box ,check box,and textbox Admission Form
Program
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 Admission_Form_with_List_Box
{
public partial class frmAdmission : Form
{
public frmAdmission()
{
InitializeComponent();
}
private void btnDisplay_Click(object sender, EventArgs e)
{
double mobt = 0, mtot = 0,
iobt = 0, itot = 0,
bobt = 0, btot = 0,
merit = 0;
int hafiz = 0, computer = 0;
if (chkHafiz.Checked)
{
hafiz = 20;
}
if (chkComputer.Checked)
{
computer = 10;
}
if (lstProgram.SelectedIndex != -1)
{
if (lstProgram.SelectedItem.ToString() == "BS( CS )")
{
iobt = Convert.ToDouble(txtIObt.Text);
itot = Convert.ToDouble(txtITot.Text);
merit = (iobt + hafiz) / itot * 100;
txtMerit.Text = merit.ToString();
if (merit > 80)
{
txtRemarks.Text = "Congratulations...!";
}
else
{
txtRemarks.Text = "Wait for other merit list";
}
}
else if (lstProgram.SelectedItem.ToString() == "MCS")
{
mobt = Convert.ToDouble(txtMObt.Text);
mtot = Convert.ToDouble(txtMTot.Text);
merit += mobt / mtot * 30;
iobt = Convert.ToDouble(txtIObt.Text);
itot = Convert.ToDouble(txtITot.Text);
merit += iobt / itot * 30;
bobt = Convert.ToDouble(txtBObt.Text);
btot = Convert.ToDouble(txtBTot.Text);
merit += (bobt + hafiz + computer) / btot * 40;
txtMerit.Text = merit.ToString();
if (merit > 71)
{
txtRemarks.Text = "Congratulations...!";
}
else
{
txtRemarks.Text = "Wait for other merit list";
}
}
}
}
private void lstProgram_SelectedIndexChanged(object sender, EventArgs e)
{
if (lstProgram.SelectedIndex != -1)
{
if (lstProgram.SelectedItem.ToString() == "BS( CS )")
{
txtAppNo.Enabled = true;
txtName.Enabled = true;
txtMObt.Enabled = false;
txtMTot.Enabled = false;
txtIObt.Enabled = true;
txtITot.Enabled = true;
txtBObt.Enabled = false;
txtBTot.Enabled = false;
}
else if (lstProgram.SelectedItem.ToString() == "MCS")
{
txtAppNo.Enabled = true;
txtName.Enabled = true;
txtMObt.Enabled = true;
txtMTot.Enabled = true;
txtIObt.Enabled = true;
txtITot.Enabled = true;
txtBObt.Enabled = true;
txtBTot.Enabled = true;
}
}
}
private void frmAdmission_Load(object sender, EventArgs e)
{
txtAppNo.Enabled = false;
txtName.Enabled = false;
txtMObt.Enabled = false;
txtMTot.Enabled = false;
txtIObt.Enabled = false;
txtITot.Enabled = false;
txtBObt.Enabled = false;
txtBTot.Enabled = false;
}
private void btnClear_Click(object sender, EventArgs e)
{
lstProgram.ClearSelected();
txtAppNo.Clear();
txtName.Clear();
txtAppNo.Enabled = false;
txtName.Enabled = false;
rdoMale.Checked = false;
rdoFemale.Checked = false;
chkComputer.Checked = false;
chkHafiz.Checked = false;
txtMObt.Enabled = false;
txtMTot.Enabled = false;
txtIObt.Enabled = false;
txtITot.Enabled = false;
txtBObt.Enabled = false;
txtBTot.Enabled = false;
txtMerit.Enabled = false;
txtRemarks.Enabled = false;
txtMObt.Clear();
txtMTot.Clear();
txtIObt.Clear();
txtITot.Clear();
txtBObt.Clear();
txtBTot.Clear();
txtMerit.Clear();
txtRemarks.Clear();
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Post A Comment:
0 comments: