Click here to Skip to main content
11,496,146 members (461 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
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
Comments
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 ?
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!
  Permalink  
YOUR FIND THIS
THIS IS BLOODED CODE LINK

http://www.cnblogs.com/xe2011/p/3780793.html
http://files.cnblogs.com/xe2011/WindowsFormsApplication_LimitRichTextBoxInput.rar
  Permalink  
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600


Advertise | Privacy | Mobile
Web04 | 2.8.150520.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