Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.IO;
- using System.Diagnostics;
- namespace WindowsFormsApplication1
- {
- public partial class MainForm : Form
- {
- public MainForm()
- {
- InitializeComponent();
- }
- private void btnSubmit_Click(object sender, EventArgs e)
- {
- listBox.Items.Add(txtInput.Text)
- txtInput.Clear();
- }
- private void btnSaveToFile_Click(object sender, EventArgs e)
- {
- if (listBox.Items.Count > 0)
- {
- {
- using (TextWriter TW = new StreamWriter("list.txt"))
- {
- foreach (string itemText in listBox.items)
- {
- TW.WriteLine(itemText);
- }
- }
- Process.Start("list.txt")
- }
- private void btnCopyToClip_Click(object sender. EventArgs e)
- {
- if (listBox.Items.Count > 0)
- {
- StringBuilder SB = new StringBuilder();
- foreach (string itemValue in listBox.Items)
- {
- SB.AppendLine(itemValue);
- }
- //Further process text here, ex remove last newline https://www.youtube.com/watch?v=aIeiVfzJ1sU
- string result = SB.ToString().TrimEnd('\n');
- Clipboard.SetText(result);
- }
- }
- }
- }
- // textinputbox, submit, listbox, copytoclipboard, savetofile.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement