Search code examples
.netwinformswebbrowser-controlc#-6.0

WinForms WebBrowser control Url poperty not updating


My Windows Forms project contains a WebBrowser control. When I try to change the Browsers Url property, it doesn't change.

Uri url = new Uri(someString);
myWebBrowser.Url = url;
MessageBox.Show((myWebBrowser.Url == url).ToString()); // the message box says 'false'

Why is the property not changing and how do I get it to change?


Solution

  • Ok so it takes time for the property to change after you set it.

    Also setting the URL isn't the best way to change the webpage. Using myWebBrowser.Navigate(url); is better.