Add DataGridViewRow into no rows DataGridView

This is another way to add DataGridViewRow into no rows DataGridView with out Clone() method. In C#

//add new empty row
int rowIndex = this.myDataGridView.Rows.Add(); 
//get datagridrow from index
DataGridViewRow row = this.myDataGridView.Rows[rowIndex]; 
//set value
row.Cells["id"].Value = "1"; 
row.Cells["name"].Value = "name_1";

This way only use when DataGridView is not binding with data-bound


About WK

Kajook is a Senior Software Engineer. Job is Design & Develop in Java EE environment on Glassfish. I'm Interested in Agile software development ,iOS and Android.
This entry was posted in knowledge and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s