Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Background worker

Posted on 2014-03-13
5
Medium Priority
?
527 Views
Last Modified: 2014-03-14
Hi Experts,

I have a Winform with a tab control on it. In one of the tab pages I have a button and a webrowser. When I click the button the webbrowser navigates to the required url. I use a background worker to navigate to the webpage so that I can select and use another tab page while the navigation is taking place. The problem is that the UI locks up during the navigation event and does not allow me to select another tab page until the navigation has completed. What am I doing wrong?

Public Class Form1

    Private Sub ButtonNavigate_Click(sender As System.Object, e As System.EventArgs) Handles ButtonNavigate.Click

        BackgroundWorkerBrowser.RunWorkerAsync()

    End Sub

    Private Sub BackgroundWorkerBrowser_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorkerBrowser.DoWork

        WebBrowser1.Navigate("http://www.betexplorer.com/next/soccer/")

    End Sub

End Class

Open in new window

0
Comment
Question by:DColin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:Ammar Gaffar
ID: 39927224
Hi DColin,

The page you are trying to load contains scripts errors, try to load another page like www.microsoft.com it will work normally.

I used you scenario, even without using any background worker and it worked very smooth with url www.microsoft.com 

Good Luck
0
 

Author Comment

by:DColin
ID: 39927248
Ammar Gaffar,

I do not want to load microsoft.com I want to load the website from my question.
0
 
LVL 12

Expert Comment

by:Ammar Gaffar
ID: 39927453
Dear DColin,

You can set the WebBrowser's property ScriptErrorsSuppressed to True,  it will let you to navigate in your form's control.

Good Luck
0
 

Author Comment

by:DColin
ID: 39927517
Ammar Gaffar,

I have set ScriptErrorsSuppressed to True and no difference. I access this page using Firefox, Chrome and IE8 and do not get script errors reported. How do you know it has script errors?

If the page has loading errors why should this cause the webbrowser thread to lock the UI thread?
0
 
LVL 12

Accepted Solution

by:
Ammar Gaffar earned 2000 total points
ID: 39927568
Dear,
Did you try to load different page e.g www.microsoft.com ? When I took microsoft as an example I just need to confirm is it from the web page itself or the browser or from your code.

Web Browser control is based on IE only, so even if the page is loaded well in other browsers that will not help much.

Anyway, I am using IE 11 and when I used your code script error dialog is appeared, and I did cross check in FireFox using Web Developer add-on and here below the error description:

Timestamp: 3/14/2014 12:04:17 AM
Error: A promise chain failed to handle a rejection.

Date: Fri Mar 14 2014 00:04:06 GMT+0400 (Arabian Standard Time)
Full Message: Win error 183 during operation makeDir (Cannot create a file when that file already exists.
)
Source Code:
0


I do believe that your code is fine, and to confirm it use another url and check!

Good Luck
0

Featured Post

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question