Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はc#を使用しており、フォームにデータがロードされたdatagridviewコントロールを持っています。セルの値がテキストボックスの値と一致する行を選択してフォーカスを設定したいと思います。どうすればこれについて行くことができますか。
これは、テキストボックス内の値の最初のインスタンスと一致します
iCurrrow = -1
foreach (dgv.Rows の DataGridViewRow 行)
{
if (row.Cells[0].Value.ToString().Equals(TextBox.Text)) { iCurrrow = row.Index; break; }
}
dgv.CurrentCell = dgv.Rows[iCurrrow].Cells[0];