0% found this document useful (0 votes)
18 views1 page

Form Lab 1

The document contains a C# Windows Forms application code for creating a text file. It defines a form 'FrmLab1' that allows users to input text and save it to a file in the Documents folder. The application also includes dialogs for filename input and registration after file creation.
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)
18 views1 page

Form Lab 1

The document contains a C# Windows Forms application code for creating a text file. It defines a form 'FrmLab1' that allows users to input text and save it to a file in the Documents folder. The application also includes dialogs for filename input and registration after file creation.
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/ 1

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;
using System.IO;
namespace BasicTextFile
{
public partial class FrmLab1 : Form
{

public FrmLab1()
{
InitializeComponent();
}

private void btnCreate_Click(object sender, EventArgs e)


{
frmFilename frm = new frmFilename();
frm.ShowDialog();
string getInput;
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);
outputFile.Close();
}
frmRegistration reg = new frmRegistration();
reg.ShowDialog();
Close();
}

}
}

You might also like