0

I want to have 2 webbrowser controls and 1 button. With the 2nd webbrowser control always showing whatever is being displayed in the 1st webbrowser control. For example, if I click a link in the 1st webbrowser, the new content showing in this control should also refreshed on the 2nd webbrowser control. However, when I click the button, whatever being changed in the 1st webbrowser control WILL NOT be reflected in the 2nd webbrowser control ie they become independent, and I don't want to reset the 2nd webbrowser control. Any idea of doing this?

Thanks
Gamer1225

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by gamer1225
2

You could synchronize the 2nd WebBrowser's loaded page using the webBrowser1_Navigated event handler:

private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            if (bSychronize)
            {
                if (webBrowser1.Url.ToString() != webBrowser2.Url.ToString())
                    webBrowser2.Navigate(e.Url.ToString());
            }
        }

In the above, the boolean bSynchronize can be toggled by a button click event:

private void button1_Click(object sender, EventArgs e)
        {
            bSychronize = !bSychronize;
        }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.