1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Click facebook like/unlike button in vb6

Discussion in 'Visual Basic .NET' started by coolcurrent, Apr 28, 2011.

  1. coolcurrent

    coolcurrent Newbie

    Joined:
    Feb 15, 2011
    Messages:
    25
    Likes Received:
    0
    I tried without success to click the facebook like button in code with the webrowser control, but it doesn't work, here is the cod i used


    Code:
    Private Sub ClickLikeUnlike()
        '# click like or Unlike button here
    
        On Error GoTo ErrorHandler:
        Dim InputCollection      As HTMLElementCollection
        Dim curElement           As HTMLHtmlElement
        Dim href                 As HTMLAnchorElement
        Dim HtmlDoc              As HTMLDocument
    
        
        Set HtmlDoc = wbMain.document
        Set allelement = HtmlDoc.All
        For Each href In HtmlDoc.links
            If LCase$(href.innerText) = "like" Then
                Debug.Print href.innerHTML
                href.Click
                Exit For
            Else
                Debug.Print href.innerHTML
            End If
        Next
        Exit Sub
    ErrorHandler:
        Debug.Print Error
    End Sub
    
     
  2. shudogg

    shudogg Regular Member

    Joined:
    Sep 23, 2008
    Messages:
    412
    Likes Received:
    153
    Occupation:
    Internet Marketing
    Location:
    Indiana
    Home Page:
    People still program in Visual Basic 6???? :pat:

    Upgrade to Visual Basic 2010, or better yet, just jump into C#. C# to me, is a cross between C++ and Visual Basic... Not that it "really" is (so don't flame), thats just what I think when I work in C#. I am a hell of a lot more fluent in VB, however I know enough in # to get around well.

    I highly recommend you stop using VB6 right now.. It is like 13 years old, and MS dropped support for VB6 a few years ago!!! It is a dinosaur now. And if you are going to make the change, I suggest learning C#. There is a lot of differences (and similarities) from VB6 to 2008/2010. Due to the differences your going to face making the change, I recommend just going for C#!

    Not to offend, but really you should let VB6 be extinct. Best of luck.