Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB.NET
Expertise: Advanced
Jan 11, 2005

Create and Execute Web Links with the LinkLabel Control

Visual Basic .NET makes Web links easy with the LinkLabel control. You'll find this control in the standard Visual Basic.NET Toolbox. Simply click on it, draw it on your form, and set the Text property to your desired URL. To navigate to the link, add the following code to the LinkClicked() event of the LinkLabel:

	System.Diagnostics.Process.Start _(LinkLabel1.Text)
The Start method of the Process class executes the application string to which you pass it. If you don't supply an application to the method, the text you pass to it dictates which application the system launches. So, if you just pass it a URL, it opens it using Microsoft Internet Explorer.

The LinkLabel control comes equipped with quite a few properties to help you create the perfect Web link. For example, you can enter lines and lines of text into the control's Text property. Then, use the LinkArea property and associated LinkArea Editor to select only the text you want for the link. You can also specify whether the text has a permanent underline, no underline, or an underline visible only when the user hovers over the link using the LinkBehavior property. The valid values for this property are SystemDefault, AlwaysUnderline, HoverUnderline, and NeverUnderline. For additional customization, change the default link color and visited link color using the LinkColor and VisitedLinkColor properties. You can even embed an image right into the link using the Image property.

Parthasarathy Mandayam
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap