TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bob Gatto
NA
44
8.2k
I cannot access richTextBox1.Document which I need for storing into db
Dec 24 2020 2:51 PM
I have a Windows Form (.NET Framework) with a rich text box and I want to store its data to a database. Through my research, the code I found was:
string rtfText;
//string to save to db
TextRange tr =
new
TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);
using
(MemoryStream ms =
new
MemoryStream())
{
tr.Save(ms, DataFormats.Rtf);
rtfText = Encoding.ASCII.GetString(ms.ToArray());
}
When I try to add line 2 to my code, I get to richTexBox. but Document cannot be found when I type it.
Now when I added a reference, I selected PresentationFramework, and at the top of my code, added the line:
using
System.Windows.Documents;
using
System.Windows.Controls;
and I still cannot access richTextBox1.Document. I'm using Visual Stusio 2019 and am using .NET Framework 4.7.2.
How can I access richTextBox.Document?
Thanks for the help,
Bob Gatto
Reply
Answers (
6
)
How to bind images in rdlc report
loading picturebox image from file