WPF RichTextBox Content (text+image) save to database



In this article I will provide a tip for how we can save the WPF RichTextBox content (text+image) into database.
image1.gif

Create a WPF window and add RichTextBox to it.

Add 3 buttons to the window->

  1. For FileOpenDialog to insert image to the RichTextBox
  2. To save the content to the database
  3. To retrieve content from the database


Create a Table in your database with one column type TEXT

image2.gif

Add the following code to the above added buttons

image3.gif

image4.gif