更新时间:2023-12-01 10:01:28
试试这个:
Try this:
private void InsertNewRowToDGV()
{
//we have to get the index of a last row id:
int index = this.dataGridView1.Rows.Count;
//and count +1 to get a new row id:
index++;
this.dataGridView1.Rows.Add();
}
参考更多详情:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.rowsadded.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/5s3ce6k8 .aspx [ ^ ]
请在下面给出此代码
将空白行添加到数据网格视图中
Please this code given bellow
to add blank row into the data grid view
DataGridView.Rows.Add()
。
.
Or Can you use this coding also
Suppose I have a DataGridView having three columns named ItemName,Itemcode and ItemQuantity
for that you can use following code given bellow
DataGridView.Rows.Add("ItemName","ItemCode","Quantity",)