axwebbrowser help - fetching info

GrenadeFX

Newcomer
Joined
Jan 20, 2005
Messages
21
Location
Australia
Im not sure if this is a correct place fro this post but here it is anyway btw thanx in advance for help

ok i have a webbrowser on my form called wb1 on startup, it loads a page that has some text on it. I wouldnt mind knowing how i can red some of that text of the page and place it in a label control

thanx guys
 
You can use a webclient with streamreader to save the html code which of course has the text with it somewhere. Here is a sample code of how to import a webpages html code to a textbox. All you have to do from here is do a search through that string and pull out whatever you need. Im sure there is probably a better way to do this but this just came to my head :p





Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dim htmlstr as string
dim sr as io.streamreader
dim wc as new net.webclient
dim s as string
'--------------------------------------------------------------------------------
' this will create a large string and save it to var s
htmlstr = "http://mysite.com"

sr = New IO.StreamReader(wc.OpenRead(htmlstr))
s = sr.ReadToEnd
sr.DiscardBufferedData()
sr.Close()
wc.Dispose()
TextBox1.Text = s

's now contains all the html and displays it in a textbox
 
Back
Top