title: prevent warnings on variables which aren't assigned a value in a Try
body: <p>I found some code on the internet as below (slightly modified).</p>
  
  <p>It simply requests the content of a webpage.</p>
  
  <pre><code>Private Sub readWebpage(ByVal url As String)
      Dim Str As System.IO.Stream
      Dim srRead As System.IO.StreamReader
      Try
          ' make a Web request
          Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(url)
          Dim resp As System.Net.WebResponse = req.GetResponse
          Str = resp.GetResponseStream
          srRead = New System.IO.StreamReader(Str)
          ' read all the text 
          textContent.text = srRead.ReadToEnd
      Catch ex As Exception
          MsgBox(ex.Message, MsgBoxStyle.Critical, "Unable to download content from: " &amp; url)
      Finally
          srRead.Close()
          Str.Close()
      End Try
  End Sub
  </code></pre>
  
  <p>However I get two warnings:</p>
  
  <pre><code>Warning 1   Variable 'srRead' is used before it has been assigned a value. A null reference exception could result at runtime.
  
  
  Warning 2   Variable 'Str' is used before it has been assigned a value. A null reference exception could result at runtime.
  </code></pre>
  
  <p>I know I can simply forget about the <code>Finally</code> and add the code to the try block.</p>
  
  <p>Will that be the way to go or can I prevent the warnings using a different approach?</p>
  
  <p>Thanks in advance for enlightening me! :)</p>