If you could help me out, thanks.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO; // Adds all stuff for files
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
static String fileloc;
public Form1()
{
InitializeComponent();
ContextMenu editorMenu = new ContextMenu();
editorMenu.MenuItems.Add("Cut", cutToolStripMenuItem_Click);
editorMenu.MenuItems.Add("Copy", copyToolStripMenuItem_Click);
editorMenu.MenuItems.Add("Paste", pasteToolStripMenuItem_Click);
editorMenu.MenuItems.Add("Text Preset", button5_Click);
textBox1.ContextMenu = editorMenu;
textBox2.ContextMenu = editorMenu;
textBox3.ContextMenu = editorMenu;
textBox4.ContextMenu = editorMenu;
textBox5.ContextMenu = editorMenu;
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void label5_Click(object sender, EventArgs e)
{
}
private void button5_Click(object sender, EventArgs e)
{
textBox1.Text = "How are you?";
textBox2.Text = "Cool, thanks.";
textBox3.Text = "So what are you up to?";
textBox4.Text = "Alright well, got to go, see you later.";
textBox5.Text = "3";
textBox1.ForeColor = Color.Black;
textBox2.ForeColor = Color.Black;
textBox3.ForeColor = Color.Black;
textBox4.ForeColor = Color.Black;
textBox5.ForeColor = Color.Black;
}
private void button6_Click(object sender, EventArgs e)
{
textBox1.ForeColor = Color.Red;
textBox2.ForeColor = Color.Red;
textBox3.ForeColor = Color.Red;
textBox4.ForeColor = Color.Red;
textBox5.ForeColor = Color.Red;
}
private void textBox6_TextChanged(object sender, EventArgs e)
{
}
private void customizeToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void newRomanToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.Font = new Font("Times New Roman", 10);
textBox2.Font = new Font("Times New Roman", 10);
textBox3.Font = new Font("Times New Roman", 10);
textBox4.Font = new Font("Times New Roman", 10);
textBox5.Font = new Font("Times New Roman", 10);
textBox6.Font = new Font("Times New Roman", 10);
button1.Font = new Font("Times New Roman", 9);
button2.Font = new Font("Times New Roman", 9);
button3.Font = new Font("Times New Roman", 9);
button4.Font = new Font("Times New Roman", 9);
button5.Font = new Font("Times New Roman", 9);
button6.Font = new Font("Times New Roman", 9);
label1.Font = new Font("Times New Roman", 10);
label2.Font = new Font("Times New Roman", 10);
label3.Font = new Font("Times New Roman", 10);
label4.Font = new Font("Times New Roman", 10);
label5.Font = new Font("Times New Roman", 15);
label6.Font = new Font("Times New Roman", 8);
label7.Font = new Font("Times New Roman", 10);
}
private void tahomaToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.Font = new Font("Tahoma", 9);
textBox2.Font = new Font("Tahoma", 9);
textBox3.Font = new Font("Tahoma", 9);
textBox4.Font = new Font("Tahoma", 9);
textBox5.Font = new Font("Tahoma", 9);
textBox6.Font = new Font("Tahoma", 9);
button1.Font = new Font("Tahoma", 9);
button2.Font = new Font("Tahoma", 9);
button3.Font = new Font("Tahoma", 9);
button4.Font = new Font("Tahoma", 9);
button5.Font = new Font("Tahoma", 9);
button6.Font = new Font("Tahoma", 9);
label1.Font = new Font("Tahoma", 9);
label2.Font = new Font("Tahoma", 9);
label3.Font = new Font("Tahoma", 9);
label4.Font = new Font("Tahoma", 9);
label5.Font = new Font("Tahoma", 15);
label6.Font = new Font("Tahoma", 8);
label7.Font = new Font("Tahoma", 9);
}
private void colorToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void purpleToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.ForeColor = Color.Purple;
textBox2.ForeColor = Color.Purple;
textBox3.ForeColor = Color.Purple;
textBox4.ForeColor = Color.Purple;
textBox5.ForeColor = Color.Purple;
}
private void blackToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.ForeColor = Color.Black;
textBox2.ForeColor = Color.Black;
textBox3.ForeColor = Color.Black;
textBox4.ForeColor = Color.Black;
textBox5.ForeColor = Color.Black;
}
private void redToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.ForeColor = Color.Red;
textBox2.ForeColor = Color.Red;
textBox3.ForeColor = Color.Red;
textBox4.ForeColor = Color.Red;
textBox5.ForeColor = Color.Red;
}
private void orangeToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.ForeColor = Color.Orange;
textBox2.ForeColor = Color.Orange;
textBox3.ForeColor = Color.Orange;
textBox4.ForeColor = Color.Orange;
textBox5.ForeColor = Color.Orange;
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void exitToolStripMenuItem_Click_1(object sender, EventArgs e)
{
Application.Exit();
}
private void exitToolStripMenuItem1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
TextReader tr;
openFileDialog1.InitialDirectory = @"C:\test";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
tr = new StreamReader(openFileDialog1.FileName);
textBox1.Text = tr.ReadToEnd();
tr.Close();
fileloc = openFileDialog1.FileName;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error");
}
}
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
TextWriter tw = new StreamWriter(fileloc);
tw.Write(textBox1.Text);
tw.Close();
}
catch (Exception saveEx)
{
MessageBox.Show(saveEx.Message, "Error");
}
}
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
{
saveFileDialog1.InitialDirectory = @"C:\test";
TextWriter tw;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
tw = new StreamWriter(saveFileDialog1.FileName);
tw.Write(textBox1.Text);
tw.Close();
fileloc = saveFileDialog1.FileName;
}
catch (Exception saveEx)
{
MessageBox.Show(saveEx.Message, "Error");
}
}
}
private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
}
private void contactToolStripMenuItem1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
}
private void donateToolStripMenuItem1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.Copy();
textBox2.Copy();
textBox3.Copy();
textBox4.Copy();
textBox5.Copy();
}
private void cutToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.Cut();
textBox2.Cut();
textBox3.Cut();
textBox4.Cut();
textBox5.Cut();
}
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.Paste();
textBox2.Paste();
textBox3.Paste();
textBox4.Paste();
textBox5.Paste();
}
private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}
1. I am wondering how I would add a function to enable my "Start" Button to open a program from my C:\Users\ Folder.
2. I am also wondering how I would be able to open a .txt file so that it opens to all four lines in the GUI at once. For example, when I save and open a .txt file with multiple lines and text, it opens the writing in the .txt file to only the top line in the GUI instead of all four lines.
3. I am wondering if there is some way to set a time interval from my GUI to the second program that opens up when I hit the "Start" Button, so that when I send messages through my four lines, they can send at 1-10 second intervals.
http://imageshack.us/photo/my-images/28/84971002.png