Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VP Windows APP go to web page and fill out form ( HALP! )

Status
Not open for further replies.

MrKovacic

IS-IT--Management
Nov 5, 2002
213
US
hi all.. me again

I am so close with this one.. and i know its simple, but i am a n00b.

Here is the code I have so far...

Code:
Public Class Form1

    Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click
        WebBrowser1.Navigate("http:my address")
        status.Text = "LOADING PAGE"
        'this is where i want to put a pause so the form can load and change the status to "FILLING OUT FORM"
        With WebBrowser1
            WebBrowser1.Document.defaultformname.umxusernametochangepwd.value = "mkovacic"
            'Document.defaultformname.submit()
            ' status.Text = "FORM SUBMITTED"
        End With

    End Sub
End Class


I cant get the form to wait untill the page is loaded to start trying out the form args..

anyone know a simple way to do this?

Thanks in advance!!


Thank you!!!

Mike Kovacic
 
You could use the NavigateComplete2 event, this will fire when the page has fully loaded. Example:
Code:
Private Sub WebBrowser1_NavigateComplete2(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) Handles WebBrowser1.NavigateComplete2

        With WebBrowser1
            WebBrowser1.Document.defaultformname.umxusernametochangepwd.value = "mkovacic"
            'Document.defaultformname.submit()
            ' status.Text = "FORM SUBMITTED"
        End With
End Sub

Hope this helps

 
I tried the code next to mine and i got the following..

ScreenShot091.png


Thank you!!!

Mike Kovacic
 
Hi,

Sorry I use 2003 which comes with the axBrowser control.

For 2005 and above, I think you will need to use this event:
Code:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, _
    ByVal e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

    WebBrowser1.Document.GetElementById("umxusernametochangepwd").InnerText = "mkovacic"
    'The following line should click the Submit button,
    'You will need to find the name of the submit button and put it in the code below:
    'WebBrowser1.Document.GetElementById("SubmitButtonName").InvokeMember("Click")
    ' status.Text = "FORM SUBMITTED"
End Sub

Hopefully this will work,

If there are any problems (I can't test the code so there maybe), The following links should help you:

Submit button:

WebBrowser Object:

HtmlDocument Object:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top