|
发表于 2020-4-6 14:15:01
|
显示全部楼层
private int position = 0;
private void Button1_Click(object sender, System.EventArgs e)
{
if ((position = text2.Text.IndexOf(text1.Text.Trim(), position)) < 0)
{
position = 0;
MessageBox.Show ("搜索已到达文档末尾");
}
else
{
text2.Select(position, text1.Text.Trim().Length);
position += text1.Text.Trim().Length;
}
} |
|