Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

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

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

this.dataGrid.Rows.Add(newRow);
satrex
usually on C#, can use VB, C++. studying javascript, ruby.
http://blog.satrex.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away