110,566
社区成员
发帖
与我相关
我的任务
分享
string m = richTextBox1.Text.Substring(iii, richTextBox1.Text.Length - iii);
int j = m.IndexOf("123");
if (j >=0)
{
iii += j;
MessageBox.Show(iii.ToString());
richTextBox1.Select(iii, 3);
richTextBox1.Focus();
iii += 3;
}
else
MessageBox.Show("不能找到");
string m = richTextBox1.Text.Substring(iii, richTextBox1.Text.Length - iii);
int j = m.IndexOf("123");
if (j >= iii)
{
iii += j;
MessageBox.Show(iii.ToString());
richTextBox1.Select(iii, 3);
richTextBox1.Focus();
}
else(Messagebox.show("查找不到"+"123"));
iii++;
private void button2_Click(object sender, EventArgs e)
{
int i = richTextBox1.Text.IndexOf("123");
richTextBox1.Select(i, 3);
}
public void SelectMyString()
{
// Create a string to search for the word "fox".
String searchString = "fox";
// Determine the starting location of the word "fox".
int index = textBox1.Text.IndexOf(searchString, 16, 3);
// Determine if the word has been found and select it if it was.
if (index != -1)
{
// Select the string using the index and the length of the string.
textBox1.Select(index, searchString.Length);
}
}
int i=richTextBox1.Text.IndexOf("123");
richTextBox1.Select(i,3);