Ask a questionAsk a question
 

QuestionRichTextBox starts appendingtext from center

  • Saturday, November 07, 2009 10:06 AMjigs12383 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi All,

    I am trying to append text in RichTextBox control. But it starts appending from center of the control.

    Is there any way I can change it to start from top of the control?

    Thanks,
    Jigs

All Replies

  • Saturday, November 07, 2009 1:48 PMRikz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    I din undrstnd the actual requirement of urs but still juz check this if u wanted something like this::



    Private Sub btnAddAtFirst_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnFind.Click Dim objtextRange As TextRange Dim strVersion As String Dim objMessageParagraph As Paragraph objtextRange = New TextRange(cTextBox.Document.ContentStart, cTextBox.Document.ContentEnd) strVersion = objtextRange.Text strVersion = "Hello" & " " & strVersion objMessageParagraph = New Paragraph objMessageParagraph.Inlines.Add(strVersion) cTextBox.Document.Blocks.Clear() cTextBox.Document.Blocks.Add(objMessageParagraph) End Sub
  • Wednesday, November 11, 2009 4:03 PMZhi-Xin YeMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Jigs,

    I'm not sure I understand your question, but by default the RichTextBox.AppendText() method appends text to the end of the content.  Could you elaborate your scenario in more details?

    Best Regards,
    Zhi-Xin


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!