Button click to open a webpage ?

  • Thread starter Thread starter Martin \(Martin Lee\)
  • Start date Start date
M

Martin \(Martin Lee\)

Hi,

I am new in C sharp.

I make a button, when users click the button, I want it to open a webpage
(for example www.yahoo.com )

How to do? What should the code be?

Thanks!


Martin
 
I make a button, when users click the button, I want it to open a webpage
(for example www.yahoo.com )

How to do? What should the code be?

It depends on what you mean by "open a webpage". But .NET does have a
WebBrowser control class that can be used for this sort of thing.

Pete
 
Martin,

First things first, where is the button resued, either in windows
application or web application.

At windows application, you can instantiate a new window having the widows
webbrowser control and give the reference to what ever url that you want.

In web app, you could simply write a javascript function which will open a
new browser instance and navigate you to the given url. Search for
"window.open".
At the web, use the below like command with in your javascript

window.open("Sample.html",SampleWindow,
"height=100,width=100,status=yes,toolbar=nyes ,Target=_blank")

HTH
 
Click a button and then it will open www.yahoo.com
That's what I need.

But what does "open" mean? Do you want to display the web page in your
own application? Do you want to start a new browser process? Something
else?

If the latter, see Bjorn's reply. If the former, then as I already wrote,
the WebBrowser control should be useful. If something else, you'll need
to be more specific.

Pete
 
Back
Top