Textbox を使用して、C# でメモ帳のようなアプリケーションを作成しようとしています。そこにfind機能を実装したい。Form1 のテキスト ボックスで検索フォームのテキスト ボックスに入力されたテキストを検索し、それを強調表示する機能が必要です。できないので助けてください
Form1.cs
private void findToolStripMenuItem_Click(object sender, EventArgs e)
{
Find f = new Find();
f.Show();
}
public void find()
{
int idx = 0;
while((idx=textBox1.Text.IndexOf(text))!=1)
{
textBox1.Select();//Select the text which are found
}
}
Find.cs
public partial class Find : Form
{
Form1 f = new Form1();
public Find()
{
InitializeComponent();
}
private void Cancelbutton2_Click(object sender, EventArgs e)
{
this.Close();
}
private void Findbutton1_Click(object sender, EventArgs e)
{
f.text =textBox1.Text;
f.find();
}