Programming, website development forum Get latest updates by RSS Follow TechnicalTalk on Twitter Follow TechnicalTalk on Facebook 
HomeSearchRecent PostsLoginRegisterContact Us

Username  
Password    
  Forgot your password?  

Pages: [1]   Go Down
 
  Email this topic  |  Print
0 Members and 1 Guest are viewing this topic.

Open a website in Internet Explorer using c#.net?

 
webmaster forum
singam  Offline
Activity
0%
 
Regular Coder
Posts: 50
Topics: 19
June 19, 2010, 12:38:53 AM

public partial class Form1 : Form {
        bool mHooked;
        public Form1() {
            InitializeComponent();
            webBrowser1. DocumentCompleted += webBrowser1_DocumentCompleted;
            webBrowser1. Navigate("hxxp: www. google. com");
        }

        void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) {
            if (mHooked) return;
            // Get the form
            HtmlDocument doc = webBrowser1. Document;
            HtmlElement form = doc. Forms["f"];
            // Get the "I'm feeling lucky" button
            HtmlElement lucky = form. All["btnI"];
            lucky. Click += lucky_Click;
            mHooked = true;
        }
        void lucky_Click(object sender, EventArgs e) {
            this. Close();
        }
    }

You'll need a good DOM browser to find the button in your page if you don't know its name.
=================

Search Engine Optimisation UK | Link Building
 
  Email this topic  |  Print
Pages: [1]   Go Up
 
Jump to:  



Powered by SMF 1.1.15 | SMF © 2011, Simple Machines


Google visited last this page January 22, 2012, 03:12:23 AM