Sunday, 15 March 2015

winforms - Saving (Rich)TextBox's to memory and switching them off with a richtextbox in my form in C# -


My goal is a main richxbox in this form, and then there are many different rich textbox back-end, backwound text The box is added, deleted, and edited behind the scans all the time ... and I need to swap my richtextbox to form in the backdated with the rich box. Did I originally have a dictionary

  dictionary & lt; String, Rich Textbox & gt; RichTextBoxs = New Dictionary & lt; String, Rich Textbox & gt; ();  

And just go to

  string data = "string"; Rich Textbox Box = New Rich Textbox (); Box. Text = "for session" "+ data +" \ "start!"; Box. Tag = (string) data; RichTextBoxs.Add (data, box);  

and saves it fine, but the moment I try to do something like

  richTextBox1 = rich textbox [[string data]];  

Nothing happens! I can copy attributes like

  richTextBox1.Text = RichTextBoxs [[string data]]. Text;  

Works fine, but I need to copy all the properties with all the advanced color formatting of the text box. I do not know why this is not working, because As far as I know it should be!

Summary: I need to swap text box with text text

~ Code appreciated! And thanks in advance!

To solve your problem, you just do not have Rtf property, not text property:

  richTextBox1.Rtf = rich textbox [[string] data] .rtf;  

But I agree with David Hegge that you should directly deposit the RTF string directly into the dictionary, not in other hidden rich text boxes.


No comments:

Post a Comment