WebBrowser Object...

joshjoneswas
08-10-2005, 09:50 PM
Is there a way to interact with a Web page loaded into the Webbrowser control? I have an app that has the WB control and I would like to have the ability to fill in input fields and click buttons programatically from the app. Can this be done? How?

Thanks guys for any input!

jlm
08-11-2005, 03:18 AM
Here's how to do it (an example). Start a new form, add a webbrowser control and a command button, and add this code to the form:

Private Sub Command1_Click()
WebBrowser1.Document.Forms("the_form").elements("str").Value = "TESTTESTTEST (Neat huh?)"
End Sub

Private Sub Form_Load()
WebBrowser1.Navigate2 "http://jmcivor.com/encryption"
End Sub

load up the app and once the doc loads, hit the command button. it will send text to one of the boxes :)

Right click the page and view source to see and match up the document form names and values and stuff.

*edit
oh yea i forgot to add this. If you want to click a button on the form automatically, this is how to do it on the document that loads in my example:
WebBrowser1.Document.Forms("the_form").elements("Encrypt").Click

joshjoneswas
08-11-2005, 02:30 PM
I bow to you my friend!

That worked PERFECTLY!

That was, literally, a STOPPING point in my little project. I was going to abandon the whole program.

Here's to a few more months of VB fun again! :)

Thank you so much.

jlm
08-11-2005, 10:04 PM
Np :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum