リストボックスを使用するプロジェクトを実行しています。アイテムの追加、アイテムの削除、アイテムの更新はできますが、検索できません。これが検索用のコードです。
string search = Person.listperson[listBox1.SelectedIndex].lastname;
foreach (String s in search)
{
if (s.Equals(textBox6.Text))
{
//show searched items
MessageBox.Show("Success!");
}
}
これを手伝ってくれませんか。ありがとう :)
ここに検索用のコードがありますが、ボタンには適用されません。ボタンにこれを適用するにはどうすればよいですか?
private void textBox6_TextChanged(object sender, EventArgs e)
{
int index = listBox1.FindString(this.textBox6.Text);
if (0 <= index)
{
listBox1.SelectedIndex = index;
}
}