カレントセルを取得、設定する

DataGridViewの現在選択中のカレントセルを取得、設定するには
CurrentCellプロパティーを利用します。

            // カレントセルの値を参照
            dataGridView1.CurrentCell.Value;        // 値
            dataGridView1.CurrentCell.RowIndex;     // 行
            dataGridView1.CurrentCell.ColumnIndex;  // 列
            dataGridView1.CurrentCell.ReadOnly;     // 読み取り専用か否か

            // カレントセルを変更
            dataGridView1.CurrentCell = dataGridView1[0, 0];

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)