Reputation: 49
What is wrong with this:
webBrowser1.Url = new System.Uri("http://www.google.com");
MessageBox.Show(webBrowser1.Url.ToString());
When the message box tries to run it complains of a null exception.
I think I may have found the solution to my problem, it seems that I was trying to read the value before it was initalized, once I had checked this it worked perfectly. Noob error. :o(
Upvotes: 2
Views: 897
Reputation: 534
Did you perhaps not initialize webBrowser1?
var webBrowser1 = new WebBrowser();
webBrowser1.Url = new System.Uri("http://www.google.com");
MessageBox.Show(webBrowser1.Url.ToString());
Upvotes: 2