Click here to Skip to main content
15,916,318 members
Home / Discussions / C#
   

C#

 
AnswerRe: binding windows user control in a windows Form dynamically Pin
quiteSmart28-Jan-07 20:59
quiteSmart28-Jan-07 20:59 
QuestionGet a table through Webbrowser object? Pin
TuanNH8528-Jan-07 20:06
TuanNH8528-Jan-07 20:06 
AnswerRe: Get a table through Webbrowser object? Pin
blue_arc28-Jan-07 20:15
blue_arc28-Jan-07 20:15 
GeneralRe: Get a table through Webbrowser object? Pin
TuanNH8528-Jan-07 20:22
TuanNH8528-Jan-07 20:22 
GeneralRe: Get a table through Webbrowser object? Pin
blue_arc28-Jan-07 22:51
blue_arc28-Jan-07 22:51 
QuestionHow to recieve/send mail through mail server in C# Pin
RoshanSrivastava28-Jan-07 20:00
RoshanSrivastava28-Jan-07 20:00 
AnswerRe: How to recieve/send mail through mail server in C# Pin
ShermansLagoon28-Jan-07 20:20
ShermansLagoon28-Jan-07 20:20 
Questionprotect RTF Pin
likefood28-Jan-07 19:29
likefood28-Jan-07 19:29 
I just discovered the "\protect" and "\protect0" RTF code word (whatever RTF people call them, code words or tags or whatever). I wanted to implement it into my little program (it has a RichTextBox control).

I can get it to protect the rich text just fine (cannot be edited), but it's not unprotecting protected text at all. Can someone please take a look at my code snippet and tell me what I'm doing wrong?

Note: The following code is inside my KeyDown event handler, inside an if-block that checks for the CTRL key being down, so CTRL+P makes this run.

if (e.KeyCode == Keys.P)//protection, not printing<br />
{<br />
     string line = rtf.SelectedRtf;<br />
     string text = rtf.SelectedText;<br />
     Console.WriteLine("-----LINE-----\r\n{0}\r\n", line);<br />
     if (line.IndexOf("\\protect") > -1)//has protection therein<br />
     {<br />
          Console.WriteLine("unprotected:");<br />
          line = line.Replace("\\protect0", "");<br />
          line = line.Replace("\\protect", "");<br />
          Console.WriteLine(line);<br />
          rtf.SelectedRtf = line;<br />
     }<br />
     else<br />
     {<br />
          Console.WriteLine("protected");<br />
          int start = line.IndexOf(text, line.LastIndexOf("\\"));<br />
          int end = start + text.Length;<br />
          line = line.Insert(end, @"\protect0");<br />
          line = line.Insert(start - 1, @"\protect");<br />
          rtf.SelectedRtf = line;<br />
     }<br />
}





-Daniel
Typing too fast fro my owngood

AnswerRe: protect RTF Pin
ShishirVaidya8-Sep-10 2:18
ShishirVaidya8-Sep-10 2:18 
QuestionSave Event logs Pin
picasso228-Jan-07 14:26
picasso228-Jan-07 14:26 
AnswerRe: Save Event logs Pin
Luc Pattyn28-Jan-07 14:52
sitebuilderLuc Pattyn28-Jan-07 14:52 
GeneralRe: Save Event logs Pin
picasso228-Jan-07 15:19
picasso228-Jan-07 15:19 
QuestionCreate/Access NTFS Object Ids Pin
urbane.tiger28-Jan-07 14:10
urbane.tiger28-Jan-07 14:10 
QuestionNamespaces Pin
max2929728-Jan-07 13:30
max2929728-Jan-07 13:30 
AnswerRe: Namespaces Pin
Luc Pattyn28-Jan-07 13:44
sitebuilderLuc Pattyn28-Jan-07 13:44 
GeneralRe: Namespaces Pin
max2929728-Jan-07 13:59
max2929728-Jan-07 13:59 
GeneralRe: Namespaces Pin
Luc Pattyn28-Jan-07 14:14
sitebuilderLuc Pattyn28-Jan-07 14:14 
GeneralRe: Namespaces Pin
max2929728-Jan-07 14:20
max2929728-Jan-07 14:20 
GeneralRe: Namespaces Pin
Luc Pattyn28-Jan-07 14:27
sitebuilderLuc Pattyn28-Jan-07 14:27 
GeneralRe: Namespaces Pin
max2929728-Jan-07 14:34
max2929728-Jan-07 14:34 
GeneralRe: Namespaces Pin
Stefan Troschuetz28-Jan-07 21:19
Stefan Troschuetz28-Jan-07 21:19 
GeneralRe: Namespaces Pin
Aaron VanWieren28-Jan-07 14:14
Aaron VanWieren28-Jan-07 14:14 
QuestionServer Architecture Pin
sinklink28-Jan-07 11:12
sinklink28-Jan-07 11:12 
QuestionCopy/Paste not working for DataGridView Pin
AndrusM28-Jan-07 11:01
AndrusM28-Jan-07 11:01 
QuestionRemove tab captions ? Pin
AndrusM28-Jan-07 10:57
AndrusM28-Jan-07 10:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.