Egon
Egon

Reputation: 3848

how to launch a default browser instance within a program window?

I am creating console app, involving lots of services. I want to display a webpage within my program window. I know how to launch a new window ( http://dotnetpulse.blogspot.com/2006/04/opening-url-from-within-c-program.html )but I was wondering can I ask a browser to render a webpage withing my program window (in C#) ?

Upvotes: 2

Views: 1358

Answers (3)

davbryn
davbryn

Reputation: 7176

The best solution would likely be to use the WebBrowser control.

This can be placed on a form and allows the web page to appear inside your application.

Here is a nice example of how to go about implementing it http://ryanfarley.com/blog/archive/2004/12/23/1330.aspx

Hope this helps

Upvotes: 2

Steav
Steav

Reputation: 1486

In a Form you can use WebBrowser Control... in a Console Application there is no way wihout opening a new form.... but you could:

  • design a form with a Webbrowser Control
  • hide its border and showintask = false
  • Open it at a position in your Console-Window

Upvotes: 1

Andy Shellam
Andy Shellam

Reputation: 15545

Use the WebBrowser control and pass it the URL of the web page to render.

In your Windows form, something like (off the top of my head so may need tweaking to get it to compile):

WebBrowser browser = new WebBrowser();
browser.Dock = DockStyle.Fill;
this.Add(browser);
browser.Navigate("http://www.myurl.com");

Upvotes: 1

Related Questions