Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
Hello, i want to have a RichTextBox where a text is loaded inside.
But the User must have the chance to change only a part of the TextBox is this possible?
Posted 27-Aug-11 5:09am
Karl Sanford at 27-Aug-11 10:42am
What type of project is this? WPF, Winforms, ASP.NET?
ColdCrush at 27-Aug-11 10:49am
its a WindowsFormApplication in Visual C#.Net
BillWoodruff at 28-Aug-11 1:40am
Can you describe a bit more fully the spatial relationship of the text you do not wish the user to edit and the text you do wish to allow to be edited: are they "mixed together" in one sentence, or one paragraph, or are they contained in completely different areas ?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

There is no simple way to do what you have described. You may be able to get some ideas from this CP article:
Syntax highlighting textbox written in C#[^]
While this article is for syntax highlighting, the concept isn't too much different from what you have described. Essentially, you need to tokenize the text and perform some action on it based on the text. In this articles case, the action is to highlight or not highlight, and in your case your action is to edit or not edit. (You may even be able to use the synatx highlighting idea to identify those areas that can be edited)
If you get this working, I think it would make a great article!
Rate this: bad
Please Sign up or sign in to vote.

Solution 4


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 495
1 Sergey Alexandrovich Kryukov 479
2 OriginalGriff 360
3 Abhinav S 250
4 CHill60 240
0 Sergey Alexandrovich Kryukov 10,102
1 OriginalGriff 9,495
2 Peter Leow 5,241
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,076

Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 26 Nov 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100