LoginSignup
6
6

More than 5 years have passed since last update.

既存のDataGridViewの列を持ったDataGridViewRowを作成する

Last updated at Posted at 2012-03-15

DataGridViewRowに行を追加する際、Rows.Addと記述すると、返ってくるのはint型で、新規作成した行にアクセスするのが面倒です。
すばやくアクセスするためには、次のように記述します。

var newRow = new DataGridViewRow();
newRow.CreateCells(this.dataGrid);
// これ以降でnewRowを編集
newRow.Cells["Column1"].Value = 1;

this.dataGrid.Rows.Add(newRow);
6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6