Hello, I have a code that adds proxies to a richtext box, and I would like to make it add each proxy to the list box, Ive tried many things. Can anyone help?

private void Button1_Click(object sender, EventArgs e)
{
    string innerHtml;
    IEnumerator enumerator;
    try
    {
        if (this.WebBrowser1.Url != new Uri("http://tools.rosinstrument.com/raw_free_db.htm"))
        {
            this.WebBrowser1.Navigate("http://tools.rosinstrument.com/raw_free_db.htm");
            this.BrowserWait(false);
        }
    }
    catch (Exception exception1)
    {
        ProjectData.SetProjectError(exception1);
        Exception exception = exception1;
        ProjectData.ClearProjectError();
    }
    Regex regex = new Regex("<TD><A\\ title=\"([0-9A-Za-z\\-\\.]*?):([0-9]*?)/[A-Za-z]*\\ stat\"\\ href=\"/cgi-bin/shdb\\.pl\\?key=[0-9A-Za-z\\-\\.]*?:[^\"]*?\">[^:]*?:[0-9]*?</A></TD>");
    try
    {
        innerHtml = this.WebBrowser1.Document.Body.InnerHtml;
    }
    catch (Exception exception3)
    {
        ProjectData.SetProjectError(exception3);
        Exception exception2 = exception3;
        innerHtml = "";
        ProjectData.ClearProjectError();
    }
    MatchCollection matchs = regex.Matches(innerHtml);
    int num = 0;
    int num2 = 0;
    try
    {
        enumerator = matchs.GetEnumerator();
        while (enumerator.MoveNext())
        {
            IEnumerator enumerator2;
            Match current = (Match) enumerator.Current;
            num = 0;
            try
            {
                enumerator2 = current.Groups.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    RichTextBox box;
                    Group group = (Group) enumerator2.Current;
                    switch (num)
                    {
                        case 1:
                            box = this.RichTextBox1;
                            box.Text = box.Text + group.Value;
                            box = this.RichTextBox2;
                            box.Text = box.Text + group.Value + "\n";
                            break;

                        case 2:
                            box = this.RichTextBox1;
                            box.Text = box.Text + ":" + group.Value + "\n";
                            break;
                    }
                    num++;
                }
            }
            finally
            {
                if (enumerator2 is IDisposable)
                {
                    (enumerator2 as IDisposable).Dispose();
                }
            }
            num2++;
        }
    }
    finally
    {
        if (enumerator is IDisposable)
        {
            (enumerator as IDisposable).Dispose();
        }
    }
    this.iTotal += num2;
    if (this.iCounter < 50)
    {
        this.page.Text = Conversions.ToString(this.iCounter);
        this.proxy.Text = Conversions.ToString(this.iTotal);
        if (num2 > 0)
        {
            this.iCounter++;
            this.iAttempts++;
        }
        if (this.iAttempts < 3)
        {
            this.iAttempts = 0;
            this.WebBrowser1.Navigate("http://tools.rosinstrument.com/raw_free_db.htm?" + this.iCounter.ToString());
            this.BrowserWait(false);
            this.Button1_Click(RuntimeHelpers.GetObjectValue(sender), e);
        }
        else
        {
            Interaction.MsgBox("Can't get Proxies... WHY!?", MsgBoxStyle.OkOnly, null);
            this.RichTextBox2.Text = this.WebBrowser1.Document.Body.InnerHtml;
        }
    }
    else
    {
        Interaction.MsgBox("Done. Fetched: " + this.iTotal.ToString() + " proxies", MsgBoxStyle.OkOnly, null);
    }
}

Actualy, how would I be able to do, for each line in richtextbox, add each line to the listbox?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.