Button click to open a webpage ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin \(Martin Lee\)

    Button click to open a webpage ?

    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



  • DSK Chakravarthy

    #2
    Re: Button click to open a webpage ?

    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.ope n".
    At the web, use the below like command with in your javascript

    window.open("Sa mple.html",Samp leWindow,
    "height=100,wid th=100,status=y es,toolbar=nyes ,Target=_blank" )

    HTH

    "Martin (Martin Lee)" <lajitong888@21 cn.comwrote in message
    news:%23WxQ5zMh IHA.4196@TK2MSF TNGP04.phx.gbl. ..
    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
    >
    >
    >

    Comment

    • Peter Duniho

      #3
      Re: Button click to open a webpage ?

      On Wed, 12 Mar 2008 23:44:39 -0700, Martin (Martin Lee)
      <lajitong888@21 cn.comwrote:
      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

      Comment

      Working...