How to Use the HyperLink Control in Visual Basic.NET
Setting Up
If you have not already done so, open Visual Studio and click File > New > Web Site. Using Visual Basic as the template, select ASP.NET Empty Web Site, name the file HyperLinkControl-VB and click OK. Now right click the web site name and click Add New Item. Once again, using Visual Basic as the template, select Web Form, name the file FirstPage.aspx and click add. Repeat again but name the file SecondPage.aspx.
Step One
Open FirstPage.aspx and switch to source view. Inside the div tags type “This is the first page” and place two HyperLink controls below it.
This is the first page. <br />
<asp:HyperLink ID="HyperLink1" runat="server">HyperLink</asp:HyperLink> <br />
<asp:HyperLink ID="HyperLink2" runat="server">HyperLink</asp:HyperLink>
Yes, it is possible to find a good web host. Sometimes it takes a while to find one you are comfortable with. After trying several, we went with Server Intellect and have been very happy thus far. They are by far the most professional, customer service friendly and technically knowledgeable host we’ve found so far.
Step TwoOpen SecondPage.aspx in source view. In the open div tags type “This is the second page”.
<div>
This is the second page.
</div>
Need help with cloud hosting? Try Server Intellect. We used them for our cloud hosting services and we are very happy with the results!
Step ThreeNow we must switch back to FirstPage.aspx and change some of the properties in the HyperLink controls. Click on HyperLink1 and look in the properties window. Insert “SecondPage.aspx” to the ‘NavigateUrl’ property and insert “Second Page” to the ‘Text’ property. Click on HyperLink2 and look in the properties window. Insert “http://v4.vbasic.net” into the ‘NavigateUrl’ property and insert “Visual Basic Tutorials” into the ‘Text’ property.
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="SecondPage.aspx">Second Page</asp:HyperLink>
<br />
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="http://v4.vbasic.net">Visual Basic Tutorials</asp:HyperLink>
I just signed up at Server Intellect and couldn’t be more pleased with my fully scalable & redundant cloud hosting! Check it out and see for yourself.
OutputRun the page and you will see the sentence “This is the first page” along with two HyperLink controls called ‘Second Page’ and ‘Visual Basic Tutorials’.
If you click on the ‘Second Page’ link, it will redirect you to SecondPage.aspx with the message “This is the second page”. If you click on the “Visual Basic Tutorials” link, it will redirect you to our site, v4.vbasic.net.
Thanks for reading and make sure to download the source files to get a better understanding of how the code works.
thumbnail (2).png
