When calling on innertext values in Visual Basic 2008
50 pts.
0
Q:
When calling on innertext values in 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
ASKED: Nov 29 2008  0:36 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
29855 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
I'm not able to test it right now, but I think you could use the Substring method.

Something like this:

If Link.InnerText.Substring(1,18) = "fight a rock for $" Then
Link.InvokeMember("Click")
Last Answered: Nov 29 2008  1:48 AM GMT by Carlosdl   29855 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0