When calling on innertext values in Visual Basic 2008

125 pts.
Tags:
Code
innerText
LINKS
Visual Basic 2008
To everyone, I have a problem. I am trying to automate a mouse click with in my browser. The first word in the inner text of the link stays constant but there is a number that follows the text that changes. Here is a sample of what i have. Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click For Each Link As HtmlElement In WebBrowser1.Document.Links If Link.InnerText = "fight a rock for $" Then Link.InvokeMember("Click") Exit Sub End If Next End Sub ...the button inner text is really displayed as, fight a rock for $2,000 but the dollar amount changes, however the alpha text and $ sign stay the same as shown above in the code. Is there a way to call on the inner text of a button with out giving all of its text and perform a click? Thank you, Missy

Answer Wiki

Thanks. We'll let you know when a new response is added.

I’m not able to test it right now, but I think you could use the Substring method.

Something like this:

If Link.InnerText.<b>Substring</b>(1,18) = “fight a rock for $” Then
Link.InvokeMember(“Click”)

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following