Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Submit web form automatically in windows form?

Posted on 2007-03-29
8
Medium Priority
?
368 Views
Last Modified: 2012-06-27
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.
0
Comment
Question by:OnlineGuitarist
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18817276
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
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 total points
ID: 18817374
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
 

Author Comment

by:OnlineGuitarist
ID: 18836828
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
 

Author Comment

by:OnlineGuitarist
ID: 18836831
err, btnG is the name of the button
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18836859
Exactly..."btnG" is the submit button on this form.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question