Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. RichTextBox.Rtf property

RichTextBox.Rtf property

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharphelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sreepathi
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • S Sreepathi

      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

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      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 Hope

      S 1 Reply Last reply
      0
      • M Mazdak

        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 Hope

        S Offline
        S Offline
        Sreepathi
        wrote on last edited by
        #3

        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.

        B 1 Reply Last reply
        0
        • S Sreepathi

          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.

          B Offline
          B Offline
          Bernd Stottmeister
          wrote on last edited by
          #4

          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

          S 1 Reply Last reply
          0
          • B Bernd Stottmeister

            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

            S Offline
            S Offline
            Sreepathi
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups