954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Open a website using a form

Hi buddies,
Can any1 put my wheels on the right track.
What i wana do is...
Create a form with which is shown below..

1 textBox (To get the URL like; www.yahoo.com )
1 button (which when presss the input website will open automatically)

help me
Thnakx in advance..

Some what like that
|---------------------------------------------------------
| ____________________
|Enter URL: |_www.yahoo.com_____|
| ___
| |OK|
|--------------------------------------------------------

Qasim Khawja
Newbie Poster
1 post since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

Simply place a WebBrowser component on your form then pass it the URL
WebBrowser.Url = TextBox1.text;

JerryShaw
Posting Pro in Training
465 posts since Nov 2006
Reputation Points: 69
Solved Threads: 75
 

Hi jerry,
i'm new to c# and asp.net,well when i execute ur above statement, i get an error

The type or namespace name 'WebBrowser' could not be found (are you missing a using directive or an assembly reference?)

can u plz tell me what am i missing here...

vamshi
Newbie Poster
6 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

I am referring to a Windows Application.
The Namespace is System.Windows.Forms.WebBrowser

Are you running this from a Windows Form ?

J

JerryShaw
Posting Pro in Training
465 posts since Nov 2006
Reputation Points: 69
Solved Threads: 75
 

Add a WebBrowser (which by default will be called webBrowser1) to your form.

Or to open direct from a button etc use this code:

string website = textBox1.Text;
System.Diagnostics.Process.Start("iexplore.exe",website);

That will open IE and go to the URL that is currently in your text box.

RwCC
Junior Poster
177 posts since Jan 2006
Reputation Points: 70
Solved Threads: 4
 

in the control toolbox in VS2005 theres a linklabel control. its a label but when you click on it it takes you to a webpaeg like a hyperlink.

jbennet
Moderator
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601
 

i get this error any ideas

Error 1 An object reference is required for the nonstatic field, method, or property

Error 2 The name 'TextBox1' does not exist in the current context

Adam_Sanderson1
Newbie Poster
10 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

Thats because you dont have a textbox called textbox1.

jbennet
Moderator
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You