Results 1 to 13 of 13

Thread: [RESOLVED] [02/03] Web Browser Control Problem

  1. #1

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Resolved [RESOLVED] [02/03] Web Browser Control Problem

    Hi guys!!!

    How do I click the link of a page in a web browser control.

    I tried searching everywhere and all I get is VB 2005 ang 6.0.

    I already created a Web browser control and navigated to the website.

    How do I click the link that says "Click me here".
    Rate Me! Rate Me! Rate Me!

    Time to fly.

    Copyright GraysonSoft Inc. 2007

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] Web Browser Control Problem

    Any VB6 examples you get should be almost directly applicable because the control you're using is ActiveX, not WinForms.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: [02/03] Web Browser Control Problem

    Quote Originally Posted by jmcilhinney
    Any VB6 examples you get should be almost directly applicable because the control you're using is ActiveX, not WinForms.
    Hi Jm,

    Can you give me some examples. I might be missing a lot. This is my first time manipulating IE through VB.

    A simple one is enough.
    Rate Me! Rate Me! Rate Me!

    Time to fly.

    Copyright GraysonSoft Inc. 2007

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] Web Browser Control Problem

    I thought you said that you'd already found some VB6 examples. I don't know of any specifically because I've never done it. I'm just saying that you're using COM components so the code will be very similar to the VB6 equivalent.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Resolved Re: [02/03] Web Browser Control Problem

    Quote Originally Posted by jmcilhinney
    I thought you said that you'd already found some VB6 examples. I don't know of any specifically because I've never done it. I'm just saying that you're using COM components so the code will be very similar to the VB6 equivalent.
    Ok. I know where this discussion is going.

    Let's say I'll post Static's example of a Web Control Manipulation.

    By the way thanks Static for the tutorial.

    Code:
     Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            AxWebBrowser1.Navigate("http://dci-intra")
        End Sub
    
        Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles AxWebBrowser1.DocumentComplete
            If (sender Is AxWebBrowser1.Application) Then
                Dim AHREF As Object
                For Each AHREF In AxWebBrowser1.Document
                    Debug.Write(AHREF)
                Next
            End If
        End Sub
    Nothing is printed nor nothing has changed. Wonder why?
    Rate Me! Rate Me! Rate Me!

    Time to fly.

    Copyright GraysonSoft Inc. 2007

  6. #6

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: [02/03] Web Browser Control Problem

    Anybody?
    Rate Me! Rate Me! Rate Me!

    Time to fly.

    Copyright GraysonSoft Inc. 2007

  7. #7

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: [02/03] Web Browser Control Problem

    Calling once?
    Rate Me! Rate Me! Rate Me!

    Time to fly.

    Copyright GraysonSoft Inc. 2007

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] Web Browser Control Problem

    Have you debugged? Have you checked whether execution even enters that If block? I don't see how it could. The method is handling the DocumentComplete event of AxWebBrowser1, so the sender parameter refers to AxWebBrowser1. Your If statement is testing whether AxWebBrowser1 is the same object as AxWebBrowser1.Application, which I doubt is the case.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: [02/03] Web Browser Control Problem

    Quote Originally Posted by jmcilhinney
    Have you debugged? Have you checked whether execution even enters that If block? I don't see how it could. The method is handling the DocumentComplete event of AxWebBrowser1, so the sender parameter refers to AxWebBrowser1. Your If statement is testing whether AxWebBrowser1 is the same object as AxWebBrowser1.Application, which I doubt is the case.
    So that what it does in the If Block.

    No it does not enter the If Block. I will remove the If Block so that it will go directly to For Each Block. I will post the result shortly.

    Yes I know I am such a noob at this.

    The above statement was from Static's Web Browser Control that is made from Vb 6.0 that I have converted to Vb .NET.
    Rate Me! Rate Me! Rate Me!

    Time to fly.

    Copyright GraysonSoft Inc. 2007

  10. #10

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: [02/03] Web Browser Control Problem

    Code:
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            AxWebBrowser1.Navigate("http://dci-intra")
    End Sub
    
    Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles AxWebBrowser1.DocumentComplete
            Dim AHREF As Object
            For Each AHREF In AxWebBrowser1.Document
                Debug.Write(AHREF)
            Next
         End Sub
    Now it does not enter in the For Each Block. Hmmm...

    Wonder why?
    Rate Me! Rate Me! Rate Me!

    Time to fly.

    Copyright GraysonSoft Inc. 2007

  11. #11

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: [02/03] Web Browser Control Problem

    Calling twice?
    Rate Me! Rate Me! Rate Me!

    Time to fly.

    Copyright GraysonSoft Inc. 2007

  12. #12

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: [02/03] Web Browser Control Problem

    Calling thrice?
    Rate Me! Rate Me! Rate Me!

    Time to fly.

    Copyright GraysonSoft Inc. 2007

  13. #13

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: [02/03] Web Browser Control Problem

    Problem still not resolved?

    Ok I will try other alternatives and post again sometime.
    Rate Me! Rate Me! Rate Me!

    Time to fly.

    Copyright GraysonSoft Inc. 2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width