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|

Recommended Answers

All 7 Replies

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

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...

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

Are you running this from a Windows Form ?


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;

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

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.

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

Thats because you dont have a textbox called textbox1.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.