Starting a program from code

  • Thread starter Thread starter Dom
  • Start date Start date
D

Dom

I want to give the users a button that they can click to start up a
google search with text from a text box. How do I start IE from
code. I assume I can easily get IE to go to Google with a search
string.
 
I want to give the users a button that they can click to start up a
google search with text from a text box.  How do I start IE from
code.  I assume I can easily get IE to go to Google with a search
string.

There is a control called webbrowser in the winform controls. What you
can do is, it create a text box and a button. Have the user enter the
button, on button click, you could launch webbrowser with one of the
property url where you set with the following constant and appent the
search string at the end.
http://www.google.com/search?q=

Thats it you are done.
 
I want to give the users a button that they can click to start up a
google search with text from a text box.  How do I start IE from
code.  I assume I can easily get IE to go to Google with a search
string.

Hi,

You can start any program by using System.Diagnostics.Process class.
In this particular case you also have the alternative of using a
WebBrowser control inside your program.
 
Hi,

You can start any program by using System.Diagnostics.Process class.
In this particular case you also have the alternative of using a
WebBrowser control inside your program.

Thanks to both of you. Exactly what I needed.

Dom
 
Part from the other answers you got, there's another approach of using the
Google Search API. Which basically means that you can query google directly
from your C# application without the need for any browser, nor visiting
google.com - you do the search, and present the search results yourself
inside your application.

Just a tip if that'd be interesting :)

Cheers
 
Part from the other answers you got, there's another approach of using the
Google Search API. Which basically means that you can query google directly
from your C# application without the need for any browser, nor visiting
google.com - you do the search, and present the search results yourself
inside your application.

Just a tip if that'd be interesting :)

Cheers

--
Tobias Zimmergrenhttp://www.zimmergren.net

"Dom" <[email protected]> skrev i meddelandet



- Show quoted text -

I can start a program using the Process class. I think that's
easier. But assume I want to start Google with a given search
string. Can I then use a different search string in the same Google
window? Or do I need to start another instance of IE with the new
search string. Of course, I prefer the first approach.

Dom
 
I can start a program using the Process class.  I think that's
easier.  But assume I want to start Google with a given search
string.  Can I then use a different search string in the same Google
window?  Or do I need to start another instance of IE with the new
search string.  Of course, I prefer the first approach.

Dom

If you do it right, youcan achive this with single window. As I
mentioned before, Create a form with a text box to enter the search
string, search button and Explorer control in it. Every time search
button is clicked just change the URL value of ie control and refresh
it.
 
If you do it right, youcan achive this with single window. As I
mentioned before, Create a form with a text box to enter the search
string, search button and Explorer control in it. Every time search
button is clicked just change the URL value of ie control and refresh
it.- Hide quoted text -

- Show quoted text -

yes, I can do that, but the problem is I do not get the true IE
window. That is, I don't get the back button, forward button, or any
of the menu items, including print. I can mimic this, but that is
essentially rewriting (most) of the IE window.

DOm
 
yes, I can do that, but the problem is I do not get the true IE
window.  That is, I don't get the back button, forward button, or any
of the menu items, including print.  I can mimic this, but that is
essentially rewriting (most) of the IE window.

DOm

Oh ok, now I understand your predicament. Let me see if I can find
something else for you.
 
Dom said:
yes, I can do that, but the problem is I do not get the true IE
window. That is, I don't get the back button, forward button, or any
of the menu items, including print. I can mimic this, but that is
essentially rewriting (most) of the IE window.

use javascript:openWindow('URL')... you can also specify a window name and
then any new window with the same name will replace the old one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top