Reputation: 1883
The current code I am using is
WebBrowser browser = new WebBrowser();
browser.Url = new Uri("http://www.youtube.com/user/RayWilliamJohnson");
label1.Text = browser.Url.ToString();
but it is giving me a 'Object reference not set to an instance of an object.' on the label1.Text = browser.Url.ToString();
line. I don't know why it is doing this or how I can fix this and it is getting on my nerves so any help will be appreciated. Thanks in advance
Upvotes: 0
Views: 136
Reputation: 137438
When the debugger breaks for the exception, you can:
to see what their values are. You should be able to easily see what is null
. Then work your way up the call chain, and see where it was supposed to be initialized.
This is straightforward debugging that you will need to learn to do if you want to be a productive developer.
Upvotes: 1