-
RichTextBox.
Guru's,
Within c#'s RichTextBox, I like to be able to have a function call for the textbox that allows me to place the cursor at x,y position within the RichTextBox so that I can then display some text at that chosen position.
Is there a way in C#'s RichTextBox to do this?
Regards
John
-
Not that I know of, no. You could probably fake it, but components like these tend to be more paragraph/line oriented.
-
RichTextBox
Thanx for your prompt reply. If that's the case then, how do I get the cursor from one text box to be displayed in another box, so that I can type text in the 2nd text box? I like this to be done when a user presses a particular key. A bit like transfering the focus from one textbox to another.
Regards
John
-
On the keypress event, do a RichTextBox.Focus()
-
I did that but it doesn't work. It does not allow me to enter any text at all, not in box1 or box2.
-
1 Attachment(s)
As an example, here is what I mean & it works...
.
.
.
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.RichTextBox richTextBox2;
private System.Windows.Forms.Button btnChangeFocus;
.
.
.
bool bFocused = false;
private void btnChangeFocus_Click(object sender, System.EventArgs e)
{
if(!bFocused)
{
richTextBox2.Focus();
bFocused = true;
}
else
{
richTextBox1.Focus();
bFocused = false;
}
}
.
.
.
<I'll attach a screenshot to show you what I have>