views:

206

answers:

4

I load files to a TextBox, and I would like some of the information to be hidden and replaced with a LinkLabel (that says something like 'click me to see more'). only when the LinkLabel is clicked will the extra information be shown. the information to be hidden is marked with "/" in the file. Can you think of a way to do this? Is it possible? Thanks.

EDIT: Here is an example.

File: Hello everyone have a /nice day/ today and have a nice day /tomorrow too/. Good bye.

TextBox should show: Hello everyone have a 'click me to see more' today and have a nice day 'click me to see more'. Good bye.

If the first LinkLabel is clicked TextBox should show: Hello everyone have a nice day today and have a nice day 'click me to see more'. Good bye.

A: 

You can put that extra info into Panel (You can find it in Toolbox-->Containers). When somebody click LinkLabel you can do this:

Panel.Visible = true;
LinkLabel.Visible = false;

That would do the trick if I understood your question.

Hybryd
I need the button to appear within the text, and when clicked have the text replace that button. Thanks anyway.
Clangon
A: 

If I understand you correctly, your Link Labels are "hiding" the text. What I'd do is assign the hidden text on the Tag property of each of my Link Labels and when they are clicked, swap the Tag into my TextBox.

Brett Veenstra
Thanks, but my main problem is adding the Link Labels to the textbox. I need them to appear within the text and scroll with the text like they were only text.
Clangon
+1  A: 

You cannot put clickable zone inside a normal textbox. You have to declare a personal user control that inherits textbox an handles the click over the text

TheQult
+2  A: 

How about using a RichTextBox instead and handling the RichTextBox.LinkClicked event? In the event handler you can replace the link with the actual text. The RichTextBox has auto url detection, so it can find and create the links for you.

Mike LaSpina
I'll try it out
Clangon