title: Using With Statement instead of creating Object Reference
body: <p>I know that it is good to have meaningful variable names, but in a situation where an object is used briefly than throw it away it seems reasonable to just wrap it in a With statement.</p>
  
  <p>Consider the an example situation of looping through a Gridview's rows finding a control and updating it.</p>
  
  <pre><code>For Each gvr as GridViewRow in gvExample.Rows 
      Dim txtExample as Textbox
      txtExample = DirectCast(gvr.FindControl("txtExample"),Textbox)
      txtExample.Text = "hi"
      txtExample.Enabled = False
      '... more with same object
  next
  </code></pre>
  
  <p>This could be written using With without making a local variable:</p>
  
  <pre><code>For each gvr as GridViewRow in gvExample.Rows
      With DirectCast(gvr.FindControl("txtExample"),Textbox)
          .Text = "hi"
          .Enabled = False
      '... more with same object
      End With
  next
  </code></pre>
  
  <p>Obviously, there's also the compromise of:</p>
  
  <pre><code>For Each gvr as GridViewRow in gvExample.Rows 
     Dim txtExample as Textbox
     txtExample = DirectCast(gvr.FindControl("txtExample"),Textbox)
     With txtExample
        .Text = "hi"
        .Enabled = False
        '... more with same object
     End With
  next
  </code></pre>
  
  <p>For the sake argument, lets assume that I know <code>gvr.FindControl("txtExample")</code> will always return a Textbox.</p>
  
  <p>I have a preference for the 2nd method. Are there reasons I would want to avoid using <code>With</code> this way? Is either way or another you provide generally better? If so, why? </p>