Howto insert text in KryptonRichTextBox?

Topics related to the Krypton Toolkit.

Moderators: Phil Wright, Chris Porter

Howto insert text in KryptonRichTextBox?

Postby bkone » Thu Apr 19, 2012 4:43 pm

Hello everybody,

I'm trying to insert some text into a KryptonRichTextBox.

How do I get the current cursor position?
And how do I insert somt text at the current cursor position?

Any help is very much appreciated.

Cheers,

Bernd
bkone
 
Posts: 8
Joined: Thu Apr 12, 2012 4:21 pm

Re: Howto insert text in KryptonRichTextBox?

Postby bkone » Wed May 09, 2012 5:13 pm

Hi again,

I found it myself:

You have to get the SelectionStart property, then use Insert providing the SelectionStart value and last set the SelectionStart to the new value.

Here's an example:
Code: Select all
int currentPos = emailBodyBox.SelectionStart;
emailBodyBox.Text = emailBodyBox.Text.Insert(emailBodyBox.SelectionStart, placeholder);
emailBodyBox.SelectionStart = currentPos + placeholder.Length;
bkone
 
Posts: 8
Joined: Thu Apr 12, 2012 4:21 pm


Return to Krypton Toolkit

Who is online

Users browsing this forum: No registered users and 3 guests

cron