RichTextBox.Rtf property
-
Hi, I am working on VB.NET. And used treeView and RichTextBox to dispaly the details. When I clicked the treeView node, the details of the node are displayed in the RichTextBox and some other controls. Now I selected some text in the RichTextBox and made bold and underline. Now I want to save and retrive the same. When I used RichTextBox.Rtf, then the text is converted to rtf format, but when I retrive the same and want to display in the RichTextBox again, I need to convert back to text with Bold or Underline as I set earlier. I could set Bold and Underline to the selected text in RichTextBox using Font dialog box. Can any one help me in doing this. Thanks, Sree Sreepathi Rao
-
Hi, I am working on VB.NET. And used treeView and RichTextBox to dispaly the details. When I clicked the treeView node, the details of the node are displayed in the RichTextBox and some other controls. Now I selected some text in the RichTextBox and made bold and underline. Now I want to save and retrive the same. When I used RichTextBox.Rtf, then the text is converted to rtf format, but when I retrive the same and want to display in the RichTextBox again, I need to convert back to text with Bold or Underline as I set earlier. I could set Bold and Underline to the selected text in RichTextBox using Font dialog box. Can any one help me in doing this. Thanks, Sree Sreepathi Rao
-
Your question is not very clear, how do you exactly you want to store your rtf? You can save it as file with
RichTextBox.SaveFile()
method. Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob HopeHi Mazdak, Thanks for your reply. Actually I have some nodes in a TreeView, and RichTextBox control on a frame. Now as I navigate through the records in the treeview, the details of the node text are displayed in the RichTextBox. I selected the text in the RichTextBox and made Bold and some text to Underline. Then when I tabOut of the RichTextBox, the details are updated to the respective TreeView node. When I select the same TreeView node I would like to see the same text with Bold or Underline(what ever I set for the text). For this I have written that TreeView.SelectedNode.Text = RichTextBox.Rtf, but when I tabbed out of the RichTextBox then the TreeView node text is changed to Rtf format I think. And it is not readable and having all {.../b.../u...} etc. When I click the TreeView node again the RichTextBox also displays the same in the Rtf format and which can not be readable. I hope you got my problem. Can you help me in this please.
-
Hi Mazdak, Thanks for your reply. Actually I have some nodes in a TreeView, and RichTextBox control on a frame. Now as I navigate through the records in the treeview, the details of the node text are displayed in the RichTextBox. I selected the text in the RichTextBox and made Bold and some text to Underline. Then when I tabOut of the RichTextBox, the details are updated to the respective TreeView node. When I select the same TreeView node I would like to see the same text with Bold or Underline(what ever I set for the text). For this I have written that TreeView.SelectedNode.Text = RichTextBox.Rtf, but when I tabbed out of the RichTextBox then the TreeView node text is changed to Rtf format I think. And it is not readable and having all {.../b.../u...} etc. When I click the TreeView node again the RichTextBox also displays the same in the Rtf format and which can not be readable. I hope you got my problem. Can you help me in this please.
try the following solution: set treeview.selectedNode.text = richtextbox.text and treeview.selectednode.tag = richtextbox.rtf and retrieve richtextbox.rtf = treeview.selectednode.tag the hope dies at last
-
try the following solution: set treeview.selectedNode.text = richtextbox.text and treeview.selectednode.tag = richtextbox.rtf and retrieve richtextbox.rtf = treeview.selectednode.tag the hope dies at last
Thanks for the answer. Actually can you give me a method which will translate the Rtf formatted string to stadard text, as I am going to use the same on different controls, which are not having Rtf property with them. I am looking for a method which can translate both ways, i.e. if I send Rtf then it should return Standard string and If I send Standard string it should send Rtf formatted string. Thanks