To copy, cut, or paste text in the rich text box, create RibbonButton.Click event handlers for the Copy, Cut, and Paste buttons. Add the following code to your project:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
' type the Imports directive for the namespace
Imports C1.Win.C1Ribbon
' handles the Click event for the Copy button
Private Sub CopyBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyBtn.Click
Me.RichTextBox1.Copy()
Me.RichTextBox1.Focus()
End Sub
' handles the Click event for the Cut button
Private Sub CutBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cutbtn.Click
Me.RichTextBox1.Cut()
Me.RichTextBox1.Focus()
End Sub
' handles the Click event for the Paste button
Private Sub PasteBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteBtn.Click
Me.RichTextBox1.Paste()
Me.RichTextBox1.Focus()
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
// type the using directive for the namespace
using C1.Win.C1Ribbon;
// handles the Click event for the Copy button
private void CopyBtn_Click(object sender, EventArgs e)
{
this.richTextBox1.Copy();
this.richTextBox1.Focus();
}
// handles the Click event for the Cut button
private void CutBtn_Click(object sender, EventArgs e)
{
this.richTextBox1.Cut();
this.richTextBox1.Focus();
}
// handles the Click event for the Paste button
private void PasteBtn_Click(object sender, EventArgs e)
{
this.richTextBox1.Paste();
this.richTextBox1.Focus();
}
|
|
Note that the following properties have been set for the RibbonButton.Name properties: