title: C# textbox user input processed by a button object
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11237075/c-sharp-gui-application-that-stores-an-array-and-displays-the-highest-and-lowest">C# GUI application that stores an array and displays the highest and lowest numbers by clicking a button</a>  </p>
  </blockquote>
  
  
  
  <p>This is updated from 13 hours ago as I have been researching and experimenting with this for a few. I'm new to this programming arena so I'll be short, I'm teaching myself C# and I'm trying to learn how to have integers from a user's input into a textbox get calculated from a button1_Click to appear on the form. Yes, this is a class assignment but I think I have a good handle on some of this but not all of it; that's why I'm turning to you guys. Thanks for all of the advice guys.</p>
  
  <p>I'm using Microsoft Visual Studio 2010 in C# language. I'm using Windows Forms Application and I need to create a GUI that allows a user to enter in 10 integer values that will be stored in an array called from a button_Click object. These values will display the highest and lowest values that the user inputted. The only thing is that the array must be declared above the Click() method.</p>
  
  <p>This is what I have come up with so far:</p>
  
  <pre><code>namespace SmallAndLargeGUI
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          public void inputText_TextChanged(object sender, EventArgs e)
          {
              this.Text = inputText.Text;
          }
  
          public void submitButton_Click(object sender, EventArgs e)
          {
              int userValue; 
              if(int.TryParse(inputText.Text, out userValue)) 
          { 
  
          } 
          else 
          {
              MessageBox.Show("Please enter a valid integer into the text box.");
          } 
  
  
              int x;
              x = Convert.x.ToString();
              int squaredResults = squared(x);
              int cubedResults = cubed(x); squared(x);
              squaredLabel.Text = x.ToString() + " squared is " + squaredResults.ToString();
              cubedLabel.Text = x.ToString() + " cubed is " + cubedResults.ToString();
          }
          public static int squared(int x)
          {
              x = x * x;
              return x;
          }
          public static int cubed(int x)
          {
              x = x * squared(x);
              return x;    
          }
      }
  }
  </code></pre>
  
  <p>Now I can't run this program because line 38 shows an error message of: 'System.Convert' does not contain a definition for 'x' Also I still have to have an array that holds 10 integers from a textbox and is declared above the Click() method. Please guys, any help for me? This was due yesterday.</p>