You are on page 1of 3

Ralph Jasper Adano Even-Driven Programming

FrmStudentRecords
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 FrmLab1
{
public partial class FrmStudentRecord : Form
{
public FrmStudentRecord()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
FrmRegistration registration = new FrmRegistration();
registration.ShowDialog();
}
private void button2_Click(object sender, EventArgs e)
{
string docPath2 = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
MessageBox.Show(docPath2, "Directory", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show("'Successfully Uploaded!'", "Message", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
}

FrmRegistration
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FrmLab1
{
public partial class FrmRegistration : Form
{
public FrmRegistration()
{
Ralph Jasper Adano Even-Driven Programming

InitializeComponent();
}
private void FrmRegistration_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string getBirthday = dateTimePicker1.Text;
string getProgram = comboBox1.Text;
string getFirstName = textBox4.Text;
string getMiddleName = textBox5.Text;
string getGender = comboBox2.Text;
string getStudentNo = textBox1.Text;
string getLastName = textBox2.Text;
string getAge = textBox3.Text;
string getContactNo = textBox6.Text;
string SetFileName = string.Concat(getStudentNo, ".txt");

string docPath2 = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);


StreamWriter outputFile = new StreamWriter(Path.Combine(docPath2, SetFileName));
string[] info = {"Student No.: " + getStudentNo, "Fullname: " + getFirstName + " " + getMiddleName + ". " +
getLastName,
"Program: " + getProgram, "Age: " + getAge,
"Birthday: " + getBirthday, "Contact No.: " + getContactNo};

Console.WriteLine(getStudentNo);
foreach (string i in info)
outputFile.WriteLine(i);
outputFile.Close();
Close();
}
public string[] getStudentNo { get; set; }

private void button2_Click(object sender, EventArgs e)


{
this.Hide();
FrmStudentRecord student_Record = new FrmStudentRecord();
student_Record.ShowDialog();
}
}
}

Form1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FrmLab1
{
public partial class Form1 : Form
Ralph Jasper Adano Even-Driven Programming

{
public Form1()
{
InitializeComponent();
}

private void btnCreate_Click(object sender, EventArgs e)


{
FrmFileName fileName = new FrmFileName();
fileName.ShowDialog();
string getInput = txtInput.Text;
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, FrmFileName.SetFileName)))
{
outputFile.WriteLine(getInput);
Console.WriteLine(getInput);
}
}
}
}

FrmFileName
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 FrmLab1
{
public partial class FrmFileName : Form
{
public FrmFileName()
{
InitializeComponent();
}
private void btnOkay_Click(object sender, EventArgs e)
{
SetFileName = txtFileName.Text + ".txt";
Close();
FrmRegistration reg = new FrmRegistration();
reg.ShowDialog();
}
public static string SetFileName { get; set; }
}
}

You might also like