title: How to access a variable outside an event handler when it is defined within the event handler in c#?
body: <p>Below is some of my code in a c# windows forms application. </p>
  
  <p>It assigns a random Integer to handle. How can I access the new value of handle so it can be used by other function calls outside this button event since there is no global variables in c#? </p>
  
  <p>I've tried using a Method but it still wont recognise handle when I call it outside the button event.</p>
  
  <p>Also what would I use to make my GUI that you cannot use some of the other controls until this button is pressed?</p>
  
  <pre><code>  private void button1_Click(object sender, EventArgs e)
      {
        Int handle = 0;
        random(ref handle);
      }
  </code></pre>