Advertisement

02.19.2008 at 05:53AM PST, ID: 23174286
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Events and global variables

Tags: VB, C#, MS WebBrowser object
I'm working on a VB.NET screen scraping application that hosts a WebBrowser control. I have a global variable that needs to be available to each step of the application and then changed before running a new sequence of web activities. An example follows.
It works as expected when Step1 is only called once. This is output by debug.print when RunnAll is called:
end Step1-1
end Step2-1

A curious (to me) thing happens when I attempt to run the Step1-Step2 sequence multiple times. If I uncomment lines 9-12 and run I get the following debug.print output:
end Step1-1
end Step1-2
end Step1-3
end Step2-3
end Step2-3
end Step2-3
It looks as if Step1 is being called three times as expected but the DocumentCompleted event is only being triggered or handled for the last call to Step1. I would sure appreciate it if someone could explain what is happening here. It's probably something obvious but I can't see it. Thanks.


 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
Module Module1
    Dim b As WebBrowser = Form1.WebBrowser1
    Dim doc As HtmlDocument = b.Document
    Dim number As Integer = 0 'global variable to be available in all steps
 
    Public Sub RunAll()
        number = 1
        Step1(number)
        'number = 2
        'Step1(number)
        'number = 3
        'Step1(number)
    End Sub
 
    Public Sub Step1(ByVal i As Integer)
        AddHandler b.DocumentCompleted, AddressOf Step2
        number = i
        b.Navigate("cnn.com")
        Debug.Print("end Step1-" & number)
    End Sub
 
    Public Sub Step2(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
        RemoveHandler b.DocumentCompleted, AddressOf Step2
        b.Navigate("google.com")
        Debug.Print("end Step2-" & number)
    End Sub
End Module
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: thefridgeVFA
Solution Provided By: gbzhhu
Participating Experts: 2
Solution Grade: B
Views: 17
Translate:
Loading Advertisement...
02.19.2008 at 06:28AM PST, ID: 20928530

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.19.2008 at 07:53AM PST, ID: 20929495

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.19.2008 at 07:55AM PST, ID: 20929514

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.19.2008 at 08:18AM PST, ID: 20929765

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.19.2008 at 08:39AM PST, ID: 20929979

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.19.2008 at 09:09AM PST, ID: 20930293

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 - Hierarchy / EE_QW_2_20070628