简体   繁体   中英

Using a variable in the web browser control

I am developing a windows phone 7.1 application, which will search through different search engine after taking in the text from the textbox. I have textbox( searchBox ), four buttons for bing, google, facebook and yahoo and a web browser control. Now i need to pass the text from the textbox to the web browser. But the thing is it should be of the form "www.bing.com?q= textbox.text ". how can i implement this?

You can adjust WebBrowser.Url property

Link : http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.url.aspx

Or you can use Navigate method

  var address = "www.bing.com?q=" + textbox.Text;
  webBrowser1.Navigate(new Uri(address));

Link : http://msdn.microsoft.com/en-us/library/ms161352.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM