title: Variable '<variablename>' hides a variable in an enclosing block
body: <p>When copying and pasting a bit of sample code from MSDN, I came up with the error in the title - <a href="http://msdn.microsoft.com/en-us/library/wtk40des(VS.80).aspx" rel="nofollow noreferrer">Variable '' hides a variable in an enclosing block</a>,</p>
  
  <p>All I copied was a very basic example of a try loop.</p>
  
  <p>As it says in the suggestion "A common cause for this error is the use of Catch e As Exception inside an event handler. If this is the case, name the Catch block variable ex rather than e."</p>
  
  <p>So, I did that, changed both <code>e</code> to <code>ex</code> and it worked, however, I don't understand why this doesn't cause the same error.</p>
  
  <p>Can someone please explain better what the error is and why e causes it, and ex doesn't? </p>
  
  <p>edit - </p>
  
  <p>code example...</p>
  
  <pre><code>    Try
      Catch e As Exception
          msgbox(e.Message)
      End Try
  </code></pre>
  
  <p>.</p>
  
  <pre><code>    Try
      Catch ex As Exception
          msgbox(ex.Message)
      End Try
  </code></pre>
  
  <p>What I don't understand is why the first one causes the problem and the second one doesn't, to me, it is like... Using apples above, apple below - saying you can't use the same thing in both places, then changing both to oranges and suddenly letting it work. Surely the second is doing the same as the first.</p>