title: Why elements of HtmlElement equal to null
body: <p>The below code gives me a crash every time because elements3 is null so how to make the elements3 have some elements before I reach the loop</p>
  
  <pre><code>Dim elements3 As HtmlElement
      For Each elements3 In WebBrowser3.Document.GetElementsByTagName("textarea")
          If elements3.GetAttribute("tabindex") = "1" Then
              elements3.SetAttribute("value", Text_TO_Pass_2)
          End If
      Next
  
      For Each webpageelemnt3 As HtmlElement In WebBrowser3.Document.GetElementsByTagName("input")
          If webpageelemnt3.GetAttribute("name") = "sbutton" Then
              If webpageelemnt3.GetAttribute("tabindex") = "1" Then
                  webpageelemnt3.InvokeMember("click")
              End If
          End If
      Next
  
  
      Threading.Thread.Sleep(5000)
      WebBrowser3.Navigate(TextBox3.Text)
  </code></pre>