title: How do I get the information typed into a TextBox?
body: <p>I want to utilize the information typed into a TextBox in the future part of
  this program. This program sets it all up in a form and when I type
  something into the textbox and press the Enter key, it goes to line 32, the
  <code>Console.WriteLine</code>, correctly and shows the quoted part "do calculations
  here" but not the value, txtFolder, typed inside the TextBox.</p>
  
  <pre><code>using System;
  using System.IO;
  using System.Drawing;
  using System.Windows.Forms;
  
  public class MainForm : Form {
  
    private TextBox txtFolder;
  
    // set up the window
    public MainForm() {
      InitializeComponents();
    }
  
    private void InitializeComponents() {
      this.Text = "Textbox";
      Width = 500;
  
      // get textbox entry
      Label sbfldr           = new Label();
      sbfldr.Location        = new Point(10,140);
      sbfldr.Size            = new Size (315,20);
      sbfldr.Text = "Enter something into textbox and press the ENTER key";
      this.Controls.Add(sbfldr);
      TextBox txtFolder      = new TextBox();
      txtFolder.Location     = new Point(325,139);
      txtFolder.KeyUp += getFolder;
      txtFolder.Parent = this;
      this.Controls.Add(txtFolder);
    }
  
    private void getFolder(object sender, KeyEventArgs e) {
      if (e.KeyCode == Keys.Enter) {
        Console.WriteLine("do calculations here "+txtFolder);
        e.Handled = true;
      }
    }
  
    public class Program {
      public static void Main(string[] args) {
        Application.Run( new MainForm() );
      }
    }
  }
  </code></pre>