大家帮忙看一下...
namespace _
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string yuan = textBox1.Text;
string cha = textBox2.Text;
int n=0;
for (int i = 0; i < yuan.Length; i++)
{
n = yuan.IndexOf(cha, i);
i += n;
}
textBox1.SelectionStart=n;
textBox1.SelectionLength = yuan.Length;
}
}
}
请问我这样为什么不能选中texebox1要查找的字串,还有这样做正不正确...因为我做出来的效果是选不中要查找的字串的???