Reputation: 225
I am creating a BMI calculator, and I am wondering how to let a user click on a hyperlink when a text coded to show in a label. This is what I have so far.:
else if (bmi >= 35 && bmi <= 40)
{
bodytypetextLabel.Text = "Visit this website. http://www.sears.com/fitness-sports-treadmills/c-1020252";
}
I'm not sure what to put in front of the "" Hyperlink so that it is made available as a hyperlink in run form for a user to click if he runs into that BMI result. Please help. Thank you in advanced.
Upvotes: 0
Views: 37892
Reputation: 782
1. you need to add :
using System.Diagnostics;
2. it's that :
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("https://www.google.com");
}
Upvotes: 1
Reputation: 911
You can just use an "a" tag, an "a" tag without a URL is just like a label. Hope this helps someone.
Upvotes: 0
Reputation: 8004
bodytypetextLabel.Text = "Visit this website <a href=\"http://www.sears.com/fitness-sports-treadmills/c-1020252\">here</a>";
Upvotes: 4
Reputation: 332
use a link label instead of regular label to enable the hyperlink functionality.
You can visit here for more information.
Upvotes: 0