c1TextBox SelectionStart always return 0

Posted by: samo3889 on 11 April 2018, 4:33 am EST

    • Post Options:
    • Link

    Posted 11 April 2018, 4:33 am EST

    Hi All :slight_smile:

    i use C1TextBox Version: 4.0.20173.286

    SelectionStart is to get character index for the beginning of the current selection.

    but it’s return always 0!

    please look the following example:SelectionStartExample.Zip

    thanks

    Saleem j

    SelectionStartExample.zip

  • Posted 12 April 2018, 12:41 am EST

    Hello Saleem,

    It seems that the C1TextBox doesn’t have focus when the button is pressed. So, you can’t see the selected text or its start position.

    Please set the C1TextBox’s HideSelection property to false. This will allow the TextBox’s selected text to be displayed as selected (highlighted), even if the TextBox doesn’t have focus.

    
                c1TextBox1.HideSelection = false;   
                int i = c1TextBox1.SelectionStart;
                string k = c1TextBox1.SelectedText; 
                MessageBox.Show(i.ToString() +"\n"+ k);
    
    

    This should help. Let us know if you need any further assistance.

    Best Regards,

    Esha

  • Posted 22 April 2018, 8:42 am EST

    thanks Esha it’s work :slight_smile:

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels