Submit web form automatically in windows form?

how can i have my program click a button in browser page using the browser control. I want to do this but can't find a solution.  anyone have any ideas?

Example:  have text box in a windows form with a submit button on the windows form.  When you fill in a search term in the text box, click on the submit button, the windows form should open up google in a web browser control and show the results, but actually use the google homepage to do so, not the google api.
OnlineGuitaristAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
Here is how to do it with the WebBrowser control embedded on yor form in VB.Net 2005:

Public Class Form1

    Private firstPage As Boolean = True

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        firstPage = True
        WebBrowser1.Navigate("www.google.com")
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        If firstPage Then
            firstPage = False
            WebBrowser1.Document.All.Item("q").InnerText = TextBox1.Text
            WebBrowser1.Document.All.Item("btnG").InvokeMember("Click")
        End If
    End Sub

End Class
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Here is one where I spawn an instance of Internet Explorer:
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_21779070.html
0
 
OnlineGuitaristAuthor Commented:
so my understanding is that btnG is the name of the submit form.  If the forms button name is random, would this still be possible?
0
 
OnlineGuitaristAuthor Commented:
err, btnG is the name of the button
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Exactly..."btnG" is the submit button on this form.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.