0% found this document useful (0 votes)
2 views

code

The document is a C# Windows Forms application for student registration. It initializes arrays for days, months, and years, populates combo boxes with these values, and handles the registration process by displaying a message box with the student's details. The application captures the student's name, section, department, gender, and date of birth from user inputs.

Uploaded by

synxerious28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

code

The document is a C# Windows Forms application for student registration. It initializes arrays for days, months, and years, populates combo boxes with these values, and handles the registration process by displaying a message box with the student's details. The application captures the student's name, section, department, gender, and date of birth from user inputs.

Uploaded by

synxerious28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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 StudentRegistrationApplication
{

public partial class StudentRegistrationApplication : Form


{
private int[] DaysArray;
private int[] MonthsArray;
private int[] YearsArray;
public StudentRegistrationApplication()
{

InitializeComponent();
InitializeArrays();
InitializeComboBoxes();

private void InitializeArrays()


{

DaysArray = new int[31];


MonthsArray = new int[12];
YearsArray = new int[DateTime.Now.Year - 1899];

for (int i = 0; i < 31; i++)


{
DaysArray[i] = i + 1;
}

for (int i = 0; i < 12; i++)


{
MonthsArray[i] = i + 1;
}

for (int i = 0; i < YearsArray.Length; i++)


{
YearsArray[i] = 1900 + i;
}
}

private void InitializeComboBoxes()


{

cmbDate.Items.AddRange(Array.ConvertAll(DaysArray, x => (object)x));


cmbMonth.Items.AddRange(Array.ConvertAll(MonthsArray, x => (object)x));
cmbYear.Items.AddRange(Array.ConvertAll(YearsArray, x => (object)x));

}
private void label4_Click(object sender, EventArgs e)
{

private void cmbDate_SelectedIndexChanged(object sender, EventArgs e)


{

private void RegisterStudent_Click(object sender, EventArgs e)


{
string studentName = StudentName.Text;
string yearAndSection = SectionYear.Text;
string department = Department.Text;

int day = Convert.ToInt32(cmbDate.SelectedItem);


int month = Convert.ToInt32(cmbMonth.SelectedItem);
int year = Convert.ToInt32(cmbYear.SelectedItem);

string gender = "";


if (Male.Checked)
{
gender = "Male";
}
else if (Female.Checked)
{
gender = "Female";
}

MessageBox.Show("" + "\nStudent Name: " + studentName + "\nYear And


Section: " + yearAndSection + "\nDeapartment: " + department + "\nGender: " +
gender + "\n\nDate of birth: " + day + "\"" + month + "\"" + year );

}
}

You might also like