title: Array Index Out Of Bounds
body: <p>Index was outside the bounds of the array error occurs when trying to access a website, the first line in code below pops up with the error, and any alteration to it results in more of the same errors to the lines below that. Am I just not using a big enough array or is my code all flustered so I'm running bad numbers?</p>
  
  <p>We Start by scraping pages with a regex expression:</p>
  
  <pre><code>                string[] lines = TextBox1.Lines;
                  label2.Text = "Custom URL Status: Working";
                  this.working.Text = "Fetching Web URL(s)";
                  try
                  {
                      WebBrowser browser = this.WebBrowser1;
                      browser.ScriptErrorsSuppressed = true;
                      for (int i = 0; i &lt; lines.Length; i++)
                      {
                          browser.Navigate(lines[i]);
                          this.BrowserWait(this.WebBrowser1);
                          string[,] parameter = (string[,])this.preg_match(@"([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}[:][0-9]{1,5})", browser.Document.Body.InnerHtml);
                          if ((parameter[0, 0] == "") | (parameter[0, 0] == null))
                          {
                              this.t = new Thread(new ThreadStart(this.getFromSite1));
                              this.t.Start();
                              label2.Text = "Custom URL Status: Error";
                              return;
                          }
                          this.t = new Thread(new ParameterizedThreadStart(this._Lambda1));
                          this.t.Start(parameter);
                          browser = null;
                      }
                  }
  </code></pre>
  
  <p>This is called:</p>
  
  <pre><code>        private void _Lambda1(object a0)
          {
          this.handleList((string[,])a0);
          }
  </code></pre>
  
  <p>Which errors on the first line of this.ToolStrip:</p>
  
  <pre><code>        public void handleList(string[,] tmp)
          {
          Control.CheckForIllegalCrossThreadCalls = false;
          this.ToolStripProgressBar1.Maximum = (int)Math.Round((double)(Convert.ToDouble(tmp[2, 0]) - 1.0));
          this.ToolStripProgressBar1.Minimum = 0;
          this.ToolStripProgressBar1.Value = 0;
          int num2 = (int)Math.Round((double)(Convert.ToDouble(tmp[2, 0]) - 1.0));
          for (int i = 0; i &lt;= num2; i++)
          {
              this.ToolStripProgressBar1.Value = i;
              this.proxies.Text = Convert.ToString(this.iWork) + "/" + Convert.ToString(this.iTotal);
              this.iTotal++;
  </code></pre>