Help please - randomly one selecting item webpage

Joelw94

Newbie
Joined
Sep 10, 2013
Messages
3
Reaction score
0
I have a problem and know it will be a easy fix but for some reason i cant get my head around it.

here is my code

Dim PageElements As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("img")

For Each CurElement As HtmlElement In PageElements

listbox1.items.add(CurElement.GetAttribute("src"))

Next

Now what I want to do is grab only one so is there any thing I could replace the 'FOR EACH' with?

Many thanks,
Joel
 
I have solved it for now, I loaded all the results into a list box then randomly generated a number between 0 and lb1.items.count -1 not the best resolution but it worked
 
Back
Top