如何从richtextbox中删除所选文本? [英] how can i delete selected text from a richtextbox?

查看:528
本文介绍了如何从richtextbox中删除所选文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码,但它不起作用



I am using this code but its not working

richTextBox1.SelectedText.Replace(richTextBox1.SelectedText,"");





它在按钮的点击事件上。谢谢。



Its on the click event of a button. Thanks.

推荐答案

使用给定的代码

use given code
richTextBox1.SelectedText = "";



或者你也可以使用


or you can also use

richTextBox1.Text = richTextBox1.Text.Remove(richTextBox1.SelectionStart, richTextBox1.SelectionLength);




Doesn't
richTextBox1.SelectedText = "";



工作?



干杯


work?

Cheers


F6.RichTextBox1.Focus()





SendKeys.Send(TextBox4.Text)
F6.RichTextBox1.Focus()


SendKeys.Send(TextBox4.Text)


这篇关于如何从richtextbox中删除所选文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆