0

So, I have read several pages on here tonight. I am trying to select from a ComboBox my user agent, and check it in a WebBrowser control. It works on the first cycle, but if I change the value in the ComboBox and click the button again, the user agent doesn't change. It DOES change if I exit the program and start from scratch. What is the problem here?

    private void btnStartCash_Click(object sender, EventArgs e)
    {
       NavigateToSite();
    }

    private void NavigateToSite()
    {
        webAdFrame.Navigate("http://whatsmyuseragent.com/", null, null,
            "User-Agent: " + cboUserAgent.SelectedItem);
    }

    private void AdProxy_Load(object sender, EventArgs e)
    {
        SetUserAgentEntries();

    }

    private void SetUserAgentEntries()
    {
        cboUserAgent.Items.Add("Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0");
        cboUserAgent.Items.Add("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
        cboUserAgent.Items.Add("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A");
        cboUserAgent.Items.Add("Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16");
        cboUserAgent.SelectedIndex = 0;
    }
Dan Smith
  • 3
  • 3

0 Answers0