Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. perform search in google from c# application

perform search in google from c# application

Scheduled Pinned Locked Moved C#
questioncsharpcomhelp
7 Posts 2 Posters 9 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nelsonpaixao
    wrote on last edited by
    #1

    My application has a WebBrowser object Inside a WebBrowser object i navigate to google site and from there a want to type something in the textbox and then press search button how can i achieve that? can anyone check this code?

    WebBrowser_Main.Navigate("http://www.google.com/");

            while (WebBrowser\_Main.IsBusy == true)
            {
                Application.DoEvents();
            }
    
            HTMLDocument myDoc = new HTMLDocumentClass();
            myDoc = (HTMLDocument)WebBrowser\_Main.Document;
    
    
            HTMLInputElement otxtSearchBox = (HTMLInputElement)myDoc.all.item("q", 0);
    
            otxtSearchBox.value = "code project";
    
            HTMLInputElement btnSearch = (HTMLInputElement)myDoc.all.item("btnI", 0);
            btnSearch.click();
    

    thanks

    nelsonpaixao@yahoo.com.br trying to help & get help

    D 1 Reply Last reply
    0
    • N nelsonpaixao

      My application has a WebBrowser object Inside a WebBrowser object i navigate to google site and from there a want to type something in the textbox and then press search button how can i achieve that? can anyone check this code?

      WebBrowser_Main.Navigate("http://www.google.com/");

              while (WebBrowser\_Main.IsBusy == true)
              {
                  Application.DoEvents();
              }
      
              HTMLDocument myDoc = new HTMLDocumentClass();
              myDoc = (HTMLDocument)WebBrowser\_Main.Document;
      
      
              HTMLInputElement otxtSearchBox = (HTMLInputElement)myDoc.all.item("q", 0);
      
              otxtSearchBox.value = "code project";
      
              HTMLInputElement btnSearch = (HTMLInputElement)myDoc.all.item("btnI", 0);
              btnSearch.click();
      

      thanks

      nelsonpaixao@yahoo.com.br trying to help & get help

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You're going about it all wrong. If you want to add search capabilities to your own site or app, use the search API Google provides, here[^].

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008
      But no longer in 2009...

      N 1 Reply Last reply
      0
      • D Dave Kreskowiak

        You're going about it all wrong. If you want to add search capabilities to your own site or app, use the search API Google provides, here[^].

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008
        But no longer in 2009...

        N Offline
        N Offline
        nelsonpaixao
        wrote on last edited by
        #3

        i understand what you said, but i don´t want to do that google is a exemple, i what to login to one site using that type of code

        nelsonpaixao@yahoo.com.br trying to help & get help

        D 1 Reply Last reply
        0
        • N nelsonpaixao

          i understand what you said, but i don´t want to do that google is a exemple, i what to login to one site using that type of code

          nelsonpaixao@yahoo.com.br trying to help & get help

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          I don't do screen scraping of web pages - it's just too inefficient for me... So what's not going right with the code you posted??

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008
          But no longer in 2009...

          N 1 Reply Last reply
          0
          • D Dave Kreskowiak

            I don't do screen scraping of web pages - it's just too inefficient for me... So what's not going right with the code you posted??

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008
            But no longer in 2009...

            N Offline
            N Offline
            nelsonpaixao
            wrote on last edited by
            #5

            " Cannot convert type 'System.Windows.Forms.HtmlDocument' to 'mshtml.HTMLDocument' " it for a browsergame bots, i need to see the bot work i got the code from a project here but it uses a AxSHDocVw.AxWebBrowser and assemblers shdocvw and axshdocvw, i think is from old version for course if a change the project code it works i want do changes in code in order it to work in webbrowser object (not in AxSHDocVw.AxWebBrowser)

            nelsonpaixao@yahoo.com.br trying to help & get help

            D 1 Reply Last reply
            0
            • N nelsonpaixao

              " Cannot convert type 'System.Windows.Forms.HtmlDocument' to 'mshtml.HTMLDocument' " it for a browsergame bots, i need to see the bot work i got the code from a project here but it uses a AxSHDocVw.AxWebBrowser and assemblers shdocvw and axshdocvw, i think is from old version for course if a change the project code it works i want do changes in code in order it to work in webbrowser object (not in AxSHDocVw.AxWebBrowser)

              nelsonpaixao@yahoo.com.br trying to help & get help

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Good Luck with that...

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008
              But no longer in 2009...

              N 1 Reply Last reply
              0
              • D Dave Kreskowiak

                Good Luck with that...

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008
                But no longer in 2009...

                N Offline
                N Offline
                nelsonpaixao
                wrote on last edited by
                #7

                solved :doh: i will use that axbrowser intead, i add to tools

                nelsonpaixao@yahoo.com.br trying to help & get help

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups