EDN Admin
Well-known member
Hi Guys,<br/> <br/> I have problem in adding new row one by one to datagridview when the user clicks on add button in runtime. When the user clicks on the add button, the data row in left gridview will be displayed in the right hand gridview. I have the following code already, however, it only works for one new row, every time the button is clicked, the row will be replaced by a new row. Is there any way I can add new row to the existing rows by clicking button? Please suggests any solution. Much appreciated.<br/> <br/> Cheers<br/> <br/> Chris<br/>
<pre lang="x-c# DataTable dt = new DataTable();
dt.Columns.Add("Object_ID");
dt.Columns.Add("ThumbnailImage");
dt.Rows.Add(Convert.ToInt32(dgvObjects.CurrentRow.Cells[1].Value), dgvObjects.CurrentRow.Cells[5].Value.ToString());
dgvCarousel.DataSource = dt;
[/code]
View the full article
<pre lang="x-c# DataTable dt = new DataTable();
dt.Columns.Add("Object_ID");
dt.Columns.Add("ThumbnailImage");
dt.Rows.Add(Convert.ToInt32(dgvObjects.CurrentRow.Cells[1].Value), dgvObjects.CurrentRow.Cells[5].Value.ToString());
dgvCarousel.DataSource = dt;
[/code]
View the full article