#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    10
    Rep Power
    0

    If then, different elements


    '<div id="status" > CLOSE
    '<input id="Button1"


    Basically, i want to make an if then statement with the above elements.

    if the CLOSE text becomes OPEN (1st element), it would automatically click the button (2nd element), otherwise nothing.

    I have the following code but its insufficient or wrong. Can anyone help?



    theElementCollection = WebBrowser1.Document.GetElementsByTagName("input")
    For Each curElement As HtmlElement In theElementCollection
    ctrlIdentity = curElement.GetAttribute("id").ToString
    If ctrlIdentity = "Button1" Then
    curElement.InvokeMember("click")
    End If
    Next

    Im sorry if this question has been posted several times, but i still havent found any that answers my question.

    I hope I get a good response. Thanks
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    10
    Rep Power
    0
    hopefully someone answers.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Location
    Saint-Petersburg, Russia
    Posts
    236
    Rep Power
    28
    Im sorry if this question has been posted several times, but i still havent found any that answers my question.
    I fear you have described the problem so poorly that no one wishes to try and understand what are you about.

    Perhaps you can try and explain it better. Especially starting with what tools you are using etc.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    10
    Rep Power
    0
    I'm using visual basic 2010 express, windows form application. I'm trying to build an automated betting software. and what i want is, when the "CLOSE" text becomes "OPEN", it automatically clicks the button on the webpage.

    these are the elements on the page source:
    '<div id="status" > CLOSE
    '<input id="Button1"

    Please ignore the code on my first post. It's probably wrong.

    Thank you for your time by the way.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    10
    Rep Power
    0
    Problem Solved. If anyone encounters the same problem, the answer can be found here:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/ab279792-758f-404d-9e17-ea2b0bfbd886/if-then-different-elements?forum=vbgeneral

    Thanks Dev Shed Forums.

IMN logo majestic logo threadwatch logo seochat tools logo