[go: up one dir, main page]

0% found this document useful (0 votes)
16 views4 pages

San Martin

Uploaded by

joarc sanmartin
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)
16 views4 pages

San Martin

Uploaded by

joarc sanmartin
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/ 4

FORM 1

namespace MyNotepad
{
public partial class FrmRegistration : Form
{
public FrmRegistration()
{
InitializeComponent();
}

private void btnRegister_Click(object sender, EventArgs e)


{
Form2 form = new Form2();
form.ShowDialog();

string studentNumber = textBoxStudentNo.Text;


string fullName = textBoxLastName.Text + ", " + textBoxFirstName.Text + ", " + textBoxMI.Text;

string Program = comboBoxProgram.Text;


string Gender = comboBoxGender.Text;
string Age = textBoxAge.Text;
string Birthday = dateTimePicker1.Text;
string ContactNo = textBoxContactNo.Text;

string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer) + "\\river";


using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, Form2.SetFileName)))

{
outputFile.WriteLine("Student No.: " + textBoxStudentNo.Text);
outputFile.WriteLine("Full Name: " + fullName);
outputFile.WriteLine("Program: " + comboBoxProgram.Text);
outputFile.WriteLine("Gender " + comboBoxGender.Text);
outputFile.WriteLine("Age: " + textBoxAge.Text);
outputFile.WriteLine("Birthday: " + dateTimePicker1.Text);
outputFile.WriteLine("Contact No. " + textBoxContactNo.Text);
}

private void btnRecord_Click(object sender, EventArgs e)


{
Form3 openrecord = new Form3();
openrecord.ShowDialog();
}
}
}

FORM 2
namespace MyNotepad
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public static String SetFileName;

private void Form2_Load(object sender, EventArgs e)


{

private void textBox1_TextChanged(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{
SetFileName = textBox1.Text + ".txt";
Close();
}
}
}

FORM 3
namespace MyNotepad
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
public static string path;
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
}

private void button2_Click(object sender, EventArgs e)


{
openFileDialog1.InitialDirectory = @"C:\";
openFileDialog1.Title = "Browse Text Files";
openFileDialog1.DefaultExt = "txt";
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog1.ShowDialog();
path = openFileDialog1.FileName;
using (StreamReader streamReader = File.OpenText(path))
{
string _getText = "";
while ((_getText = streamReader.ReadLine()) != null)
{
Console.WriteLine(_getText);
lvShowText.Items.Add(_getText);
}
}
}

private void button3_Click(object sender, EventArgs e)


{

MessageBox.Show("Successfully Uploaded");
lvShowText.Clear();

}
}
}

You might also like