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

Recommended Answers

All 2 Replies

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;
        }

Thanks! That's help!

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.