none
Problem with richtextbox.... RRS feed

  • Question

  • Hello,
    I'm trying to build a messenger type message with images and text inserted into a richtextbox in vb.net.
    Images are inserted by copying them first to clipboard and then using the paste command in the Richtextbox.
    The problem I'm encountering is that I want to save the conversation to DB Mysql, but not return all RTF encoding of the richtextbox produced for the images, but only a reference code for each of them that will be translated by the system back into the image , When the conversation will be read again to be displayed.

    The problem is that in order to do this I would like to be able to insert this code somewhere within the image block in RTF after the clipboard paste (such as notes or generic information) that still allows you to view the image but without showing This code to the user.
    This would allow me to save the conversation intercepting all these codes, which along with the conversation text should be saved on the remote DB.

    If you have any idea ...
    Thank you.
    Friday, July 7, 2017 5:34 PM

All replies

  • I'm trying to build a messenger type message with images and text inserted into a richtextbox in vb.net.
    Images are inserted by copying them first to clipboard and then using the paste command in the Richtextbox.

    When you do the paste you will need to identify the image somehow (perhaps a unique text code) and create a record for the image reference that is associated with it. That could be the actual string, or a class that you create for the purpose.

    Then, before text is saved, you need to parse the RTF and replace the image element with a suitable alternative element that contains the image reference.   To do this you would need to parse the RTF, and the simplest way to do this might be to convert it to XML first:
    https://sourceforge.net/projects/rtf2xml/

    http://www.biblioscape.com/rtf15_spec.htm

    Friday, July 7, 2017 10:52 PM