我想问为什么我的代码不起作用?
目前,我能够找到用户输入的单词,但它无法突出显示richTextBoxConversation中的单词.
我应该怎么做呢?
以下是我的代码:
private void buttonTextFilter_Click(object sender, EventArgs e)
{
string s1 = richTextBoxConversation.Text.ToLower();
string s2 = textBoxTextFilter.Text.ToLower();
if (s1.Contains(s2))
{
MessageBox.Show("Word found!");
richTextBoxConversation.Find(s2);
}
else
{
MessageBox.Show("Word not found!");
}
}
Run Code Online (Sandbox Code Playgroud) 有没有一种方法可以使用代码自动将richtextbox滚动到顶部?谢谢!