how do i select last id in list box and perform a click

125 pts.
Tags:
Visual Basic
Visual Basic 2008
Visual Basic List Box
I have a list box created that pulls over inner and outer html links from my web page. I have a code to click on the link id within that list and invoke a (click) then the proper function is invoked. my problem is the page changes in number of links ect form hr to hr. but the link i need to click will always be listed at the bottom of the list box. so one day this code might work... Private Sub Button5_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click WebBrowser1.Document.Links(111).InvokeMe... End Sub BUT.... the next day the list could be shorter and the link is now at 92. so i get the error that i can only call on 0 thru 92 I cant call on the link by innertext because i have several links with the same text and i would like to keep to calling on links via the list box.
ASKED: November 28, 2008  5:21 AM
UPDATED: December 1, 2008  8:13 PM

Answer Wiki

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

The “length” property sets or retrieves the number of objects in a collection, in this case the “links” collection, so the last link will be the link at the position <i>length </i>- 1.

So I think you could use something like this:

<pre>WebBrowser1.Document.Links(WebBrowser1.Document.links.length – 1).InvokeMe…</pre>

Discuss This Question: 1  Reply

 
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
  • TryingHard
    Your awesome! That work! i have another question which is driving me insane! I'm trying to view some code with the x and y value in it. i want to be able to make a mouse click at a pin point location with in a browser. So far i'm coming up empty and wish someone would show a code example, to learn from. I just bought a 80 dollar book on vb 2008 and it only covers this in pieces. But never shows examples to view and learn from. so if anyone has any code that would perform a simple mouse click at a certain point in the browser using the (x)( y) values please share!
    125 pointsBadges:
    report

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