H
H
Hirty2016-06-04 11:20:51
WPF
Hirty, 2016-06-04 11:20:51

Add entry to RichTextBox?

FlowDocument document = new FlowDocument();
                                                    Paragraph paragraph = new Paragraph();
                                                    paragraph.Inlines.Add(new Bold(new Run(connetn)));
                                                    document.Blocks.Add(paragraph);
                                                    richTextBox.Document =document;

This is how I add a record, but it overwrites the previous ones, but I need it to add a record already to the existing ones.
Example
I pressed the button, added the number 1, pressed it a second time, added 2 to the first entry.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rou1997, 2016-06-04
@Hirty

You have a document every time a new one is created, work with the old one.

Paragraph paragraph = new Paragraph();
                                                    paragraph.Inlines.Add(new Bold(new Run(connetn)));
                                                    richTextBox.Document.Blocks.Add(paragraph);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question