tags:

views:

44

answers:

1

I am trying to break out of vb into c# and needed a personal project to get some c# practice in to cement the syntax differences in my mind.

I decided (for want of something better) to write a little twitter client, only something basic.

I have designed a user control to contain the info about each tweet (the tweet itself, the user that tweeted, the date and time etc). As we know tweets can contain embedded links in their text and I was wondering how you handle this in a windows form.

There seems to be a Linklabel control, but you don't seem to be able to have normal text in it, the Label control similarly doesn't support clickable links.

Would I have to embed a link label inside a normal label control and parse the tweet text for url's?

Or am I approaching this in completely the wrong way? :)

A: 

You can (sort of) combine normal and linked text in a LinkLabel:

this.linkLabel1.Text = "Here is some text";
this.linkLabel1.LinkArea = new LinkArea(0, 4);

Problem is, there can only (AFAIK) be one link destination, which is obviously not going to work for your purposes.

One possibility may be to use the RichTextBox, and handle the LinkClicked event. I'm not sure if that will give you enough information, but if nothing else, will provide some good practice, since that's the goal anyhow!

Dave
RichTextBox was the answer, it seems to natively understand that a link is a link, which is ideal. The LinkClicked event is a useful pointer, thanks!
JamWheel