Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 135,935 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,647 people online right now. Registration is fast and FREE... Join Now!




Adding LinkLabel-s to RichTextBox

 
Reply to this topicStart new topic

Adding LinkLabel-s to RichTextBox

cygnusX
27 Nov, 2007 - 10:49 AM
Post #1

D.I.C Head
**

Joined: 19 May, 2007
Posts: 159


My Contributions
I want to add LinkLabel-s at the end of the text in RichTextBox control.I do that with this code:

CODE

int index = richTextBox1.Text.Length;
Point position = richTextBox1.GetPositionFromCharIndex(index);
LinkLabel label = new LinkLabel();
label.Text = "whatever";
label.AutoSize = false;
label.Location = position;
label.LinkBehavior = LinkBehavior.NeverUnderline;
richTextBox1.Controls.Add(label);

*edit: Please use code tags next time. code.gif

The problem here is that i do not know how to add text right after the last added LinkLabel,i.e. i want when add LinkLabel to move the caret next to the LinkLabel.How to do that?

This post has been edited by Martyr2: 27 Nov, 2007 - 10:51 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 08:31AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month