0% found this document useful (0 votes)
8 views2 pages

FormRegistration

The document is a C# Windows Forms application for student registration. It initializes a form with options for gender and programs, collects user input, and writes the registration details to a text file in the user's Documents folder. The application captures student number, name, program, gender, contact number, age, and birthday.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

FormRegistration

The document is a C# Windows Forms application for student registration. It initializes a form with options for gender and programs, collects user input, and writes the registration details to a text file in the user's Documents folder. The application captures student number, name, program, gender, contact number, age, and birthday.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, 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.Text;
using System.Windows.Forms;
using System.IO;

namespace BasicTextFile
{
public partial class frmRegistration : Form
{
public frmRegistration()
{
InitializeComponent();
}

private void frmRegistration_Load(object sender, EventArgs e)


{
string[] ListOfPrograms = new string[]
{
"BS Information Technology",
"BS Computer Science",
"BS Information Sceince",
"BS in Accountancy",
"BS in Hospitality Management",
"BS in Tourism Management"
};
string[] Gender = new string[]
{
"Male",
"Female"
};
for (int i = 0; i < 2; i++)
{
cbGender.Items.Add(Gender[i].ToString());
}
for (int i = 0; i < 6; i++)
{
cbPrograms.Items.Add(ListOfPrograms[i].ToString());
}
}

private void button1_Click(object sender, EventArgs e)


{
string SetFileName = txtStud.Text;
string input1, input2, input3, input4, input5, input6, input7;

input1 = "Student No.: " + txtStud.Text;


input2 = "Full Name: " + txtLName.Text + "," + txtFName.Text + "," +
txtMName.Text;
input3 = "Program: " + cbPrograms.Text;
input4 = "Gender: " + cbGender.Text;
input5 = "Contact No.: " + txtContact.Text;
input6 = "Age: " + txtAge.Text;
input7 = "Birthday: " + datePickerBirthday.Value.ToString("yyyy-MM-
dd");
string[] inputs = { input1, input2, input3, input4, input5, input6,
input7 };
string docPath =
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath,
frmFilename.SetFileName)))
{
foreach(string x in inputs)
{
outputFile.WriteLine(x);
}
Close();
}

}
}
}

You might also like