|
Rank: Newbie Groups: Member
Joined: 1/5/2017 Posts: 9
|
Hello, so I want my WebControl to rotate through different URLs with a timer without reloading the pages each time. To do this I am creating a WebView for each page that I want to display and change the assigned WebView of the WebController with a timer.
As of now I created 2 different WebView objects. I assign the first WebView to the WebControl, the timer then triggers the event which assign the second WebView to the WebControl (everything is fine), however when I switch back to the first WebView I get the following exception:
System.NullReferenceException: Object reference not set to an instance of an object. at EO.Internal.a9b.b(Boolean A_0) at EO.WebBrowser.WebView.al(cm A_0, ar7 A_1) at EO.WebBrowser.WebView.a(cm A_0, ar7 A_1) at EO.WebBrowser.WebView.b(cm A_0, ar7 A_1)
When debugging I look at the properties of the first WebView and the values of the WebView are still there like the URL, so it seems like the WebView was not deleted.
This is the method I call with the timer: // Called by the timer to change the WebView of the WebController. protected void SwitchTab(object source, ElapsedEventArgs e) { if (this.webControl.WebView == this.webView) { this.webControl.WebView = this.webViewTwo; } else if (this.webControl.WebView == this.webViewTwo) { this.webControl.WebView = this.webView; } }
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
The most effective way is not to switch WebViews, but to create them all and then dynamically show/hide the one you want to display. When you switch WebViews, the old WebView is destroyed and a new one will be created.
Having that said, the error you encountered looks like an issue that have already been fixed in the latest build (it was fixed in 16.2.93.0). So please update to the latest build and see if it resolves the issue for you.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 1/5/2017 Posts: 9
|
Thanks, I just fixed it by doing what you described except that I created two WebControls and changed their visibility.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Albert wrote:Thanks, I just fixed it by doing what you described except that I created two WebControls and changed their visibility. Yes. That's the correct way to do it. Please feel free to let us know if you have any more questions. Thanks!
|
|