gr8devin23
gr8devin23

Reputation: 21

Creation of a Google Search with a TextBox

I am trying to create a google search with a text box. So how would I do that? I already have my web browser and stuff set up, but I am needing to now do the google search term. And to search, I want a key press down event that would then (if they press the enter key) it would search up the text in the box. How would I do this?

Upvotes: 0

Views: 509

Answers (1)

Jovan
Jovan

Reputation: 64

[Edited]

Since you never mentioned you were developing on WPF I have edited my answer.

Make a handler that will trigger the search, and add this inside the code block:

string strUrl = "https://www.google.com/search?q=" + HttpUtility.UrlEncode(textBox.Text);
Process proc = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo(strUrl);
proc.StartInfo = startInfo;
proc.Start();

Upvotes: 1

Related Questions