Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello there,,,,,,,

In my project there is one window form and on that form I have one linkLabel control.....

Now my question is that I want to add one web page into my project ......so that when I click on the

LinkLabel it must open that web page .....so how can I do it
Posted

You can't "add a web page" to a windows forms project - web pages needs IIS or similar to support them. However, you can open a web page within your application, or via the user browser.
To open it in your app, you need a form with a WebBrowser[^] control on it - you then use the link to pass the URL to the control, and it displays the web page. Just handle the LinkClicked event and:
C#
private void myLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {
    myWebBrowser.Navigate("www.CodeProject.com");
    }



To open it via the user browser is just as easy: handle the LinkClicked event for the LinkLabel and use:
C#
System.Diagnostics.Process.Start("http://www.CodeProject.com");
 
Share this answer
 
Comments
Faisalabadians 3-Mar-14 6:36am    
OriginalGriff sir why you have not suggested him to add a web browser control in his windows form application and load page in that web control instead?
OriginalGriff 3-Mar-14 6:53am    
Um...I did.
"To open it in your app, you need a form with a WebBrowser[^] control on it..."
Faisalabadians 3-Mar-14 7:18am    
Sorry I made a mistake while reading :(
OriginalGriff 3-Mar-14 7:22am    
:laugh:
We all do it!
Right Click on project > Add New Item > WebForm1.aspx
now on link button click,
C#
Reponse.Redirect("WEbForm1.aspx");


-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900