I am trying to use a browser control in my app but am getting the following error
"Error 1 An object reference is required for the non-static field, method, or property 'Microsoft.Phone.Controls.WebBrowser.Source.get'"
Here is my code below
public Page2() { InitializeComponent(); Loaded += Page2_Loaded; } void Page2_Loaded(object sender, RoutedEventArgs e) { search.Tap += search_Tap; } void search_Tap(object sender, System.Windows.Input.GestureEventArgs e) { WebBrowser.Source = new Uri(URLTextBox.Text, UriKind.Absolute); }
Kindly help
VulpesPosted Feb 6, 2015, 4:05 PM
When you added the WebBrowser control from the ToolBox, it should have been give a default Name property such as webBrowser1 though you might have altered this in the Properties Box to something else.
So, I'd check the Name property and use that in place of WebBrowser in this line:
WebBrowser.Source = new Uri(URLTextBox.Text, UriKind.Absolute);