Note that there are some explanatory texts on larger screens.

plurals
  1. POA button that will give me a file of inputs
    text
    copied!<p>I have a GUI with 10 rows and 4 columns. the purpose for it is for me to enter in inputs into each box, and at the bottom, click the submit button where it will give me a file with all the inputs. The problem I am having is how can I code my "button" to do this? Help?</p> <p>I am also having problems with my menustrip. Seems like everything is correct, but my visual won't accept it. Is there something wrong with my code?</p> <p>-- It is my first time working with C# and visual, so any help will be much appreciated!</p> <pre><code>Public partial class Form 1 : Form { int count; Form mdiChild; TextBox editTextBox; public Form1() { InitializeComponent(); count = 1; } private void newToolStripMenuItem_Click(object sender, EventArgs e) { mdiChild = new Form(); mdiChild.Text = “Document” + count.ToString(); mdiChild.MdiParent = this; editTextBox = new TextBox(); editTextBox.Multiline = true; editTextBox.Dock = Dockstyle.Fill; mdiChild.Controls.Add(editTextBox); mdiChild.Show(); count++; } private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = “Open a Text File”; ofd.Filter = “Text File (*.txt)|*.txt|All Files (*.*)|*.*”; DialogResult dr = ofd.ShowDialog(); If (dr == DialogResult.OK) { System.IO.StreamReader sr = new System.IO.StreamREader(ofd.FileName); Form activeChildForm = this.ActiveMdiChild; If (activeChildForm != null) activeTextBox.Text = sr.ReadToEnd(); { System.IO.StreamReader sr = new System.IO.StreamREader(ofd.FileName); Form activeChildForm = this.ActiveMdiChild; If (activeChildForm != null) activeTextBox.Text = sr.ReadToEnd(); sr.Close(); } } } private void saveToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Title = “Save a Text File”; sfd.Filter = “Text File (*.txt)|*.txt|All Files (*.*)|*.*”; DialogResult dr = sfd.ShowDialog(); If (dr == DialogResult.OK) { System.IO.StreamWriter sw = new System.IO.StreamWriter(sfd.FileName); Form activeChildForm = this.ActiveMdiChild; If (activeChildForm != null) { TextBox activeTextBox = (TextBox)activeChildForm.ActiveControl; If (activeTextBox != null) sw.Write(activeTextBox.Text); sw.Close(); } } } private void cutToolStripMenuItem_Click(object sender, EventArgs e) { Form activeChildForm = this.ActiveMdiChild; if (activeChildForm != null) { TextBox activeTextBox = (TextBox)activeChildForm.ActiveControl; if (activeTextBox != null) activeTextBox.Cut(); } } private void copyToolStripMenuItem_Click(object sender, EventArgs e) { Form activeChildForm = this.ActiveMdiChild; if (activeChildForm != null) { TextBox activeTextBox = (TextBox)activeChildForm.ActiveControl; if (activeTextBox != null) activeTextBox.Copy(); } } private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { Form activeChildForm = this.ActiveMdiChild; if (activeChildForm != null) { TextBox activeTextBox = (TextBox)activeChildForm.ActiveControl; if (activeTextBox != null) activeTextBox.Paste(); } } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } private void button1_Click(object sender, EventArgs e) { String file_name = “C:\\test1.txt”; System.IO.StreamReader objReader; objReader = new System.IO.StreamReader(file_name)l textBox1.Text = objReader.ReadToEnd(); objReader.Close(); } Private void helpToolStripMenuItem_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start (“ “); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload