Insert numbered list programmatically

3 posts, 1 answers
  1. Igor
    Igor avatar
    2 posts
    Member since:
    Mar 2013

    Posted 21 Mar 2013 Link to this post

    How can a numbered (or bulleted) list be inserted into a rich text box programmatically?
  2. Answer
    Jack avatar
    2333 posts

    Posted 26 Mar 2013 Link to this post

    Hello Igor,

    You can do this by using the RadRichTextBox API for text search and selection. Please consider the following code snippet:
    DocumentTextSearch search = new DocumentTextSearch(radRichTextBox1.Document);
    TextRange range = search.Find("start");
    TextRange range2 = search.Find("end", range.EndPosition);
    if (range != null && range2 != null)

    I hope it helps.
    All the best,
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  3. Igor
    Igor avatar
    2 posts
    Member since:
    Mar 2013

    Posted 29 Mar 2013 Link to this post

    Thank you for your help. I managed to achieve this in the following way (VB.NET):

    For Each item As String In itemList
        radRichTextBox1.Insert(item & Environment.NewLine)
    'Format the item list as numbered list
    Dim search As New DocumentTextSearch(radRichTextBox1.Document)
    Dim range1 As TextRange = search.Find(itemList(0))
    Dim range2 As TextRange = search.Find(itemList(itemList.Count - 1), range1.EndPosition)
    If range1 IsNot Nothing And range2 IsNot Nothing Then
    End If
Back to Top