Home » VB.NetRSS

Get text from webpage into textBox on my form.

Im working on an app that will scrape addresses from yellowpages.ca 
Right now im stuck at how I will get the "place name" into a textbox in my form. 

<spanclass="listingTitle">Magic Room The</span>

The place name is "Magic Room The"

I need that in a textbox.
 

5 Answers Found

 

Answer 1

if the html tag for the place  name use the same pattern, then use String method to extract it otherwise , regular expression may be the solution for the extraction.

kaymaf 

 

Answer 2

Can I get a little more help with this. Ive searched google but a lot of the results used the sendkey, which I dont want to use if there is another way. I only started learning vb 2 weeks ago, right now I know how to enter stuff into fields on the webpage but im stuck  with retrieving data from the webpage  into my form. 

 

Since tagName "span" appears more than once in the html, im guessing it goes something like this:

---------------------------------------------------------------------------------------------------------

Dim theElementCollection As HtmlElementCollection

theElementCollection = WebBrowser1.Document.GetElementsByTagName("span")

        For Each curElement As HtmlElement In theElementCollection

            Dim controlClass As String = curElement.GetAttribute("class").ToString

        If controlClass = "listingTitle" Then

                curElement.Make place  name a String

            End If

textbox1.text = Place name

------------------------------------------------------------------------------------------------------------

Can I get a little more assistance kaymaf, or anyone else who knows a solution. 

 

Answer 3

Post full link to the webpage  (yellowpages.ca ) so that i can see the html source and the pattern

kaymaf

 
 

Answer 5

Thanks for the reply,

here is the full link http://www.yellowpages.ca/search/si/1/Estheticians/Calgary+AB


I looked at the html source, you may have to use regular expression to extract the inner text  within the span class tag. Below is the link to regular expression forum, post the question there and ask for the regex pattern for text extraction within this html tag <span class="listingTitle">Inner Balance</span>

http://social.msdn.microsoft.com/Forums/en-US/regexp/threads

kaymaf

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter