Wriju's BLOG

.NET, Cloud and everything

Programmatically invoking the Live.com search

Live.com you need to automate that in your Windows application. You will use the WebBrowser control. This is a very powerful control and allows us to control things through DOM. Here is a small code which insert values to the live.com’s seach text box and clicks the “Go” button. I have created a windows forms application and added a WebBrowser control named “webBrowser1”.


 


//Set the value to the Search text box


webBrowser1.Document.GetElementById(“sb_form_q”).SetAttribute(“value”, “Wriju’s BLOG”);


 


//Now click the button


//this actually submits the one and only one form


//So you need to do that


webBrowser1.Document.Forms[0].InvokeMember(“submit”);


 


Namoskar!!!