I'm trying put a hyperlink on a label that I get from a database. how can this be done? I have tried something like this, however, it doesn't work at all:
for (int ctr = 0; ctr < 40; ctr++)
{
string input = labels[ctr].Text;
string pattern = @"(http)*";
Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase);
MatchCollection matches = rgx.Matches(input);
if (matches.Count > 0)
{
if (matches.Count > 0)
{
Console.WriteLine("match found");
labels[matches.Count].Text = "<a href='" + labels[matches.Count].Text + "'>" + labels[matches.Count].Text + "</a>";
break; + "</a>";
}
}
However, this code only puts it on one, and it's it on one, and even then, it's not always the right one.