2011-05-26 148 views

回答

1

首先,在DataGridView獲得行號創建一個MouseDown事件單擊

private void userGrid_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) 
{ 
    rowClicked = e.RowIndex; 
} 

然後,創建一個click事件,與上一行中的值增加了一行。繼續爲要添加的每個列添加參數。

string column1 = queueGridView.Rows[rowClicked - 1].Cells[0].Value.ToString(); 
string column2 = queueGridView.Rows[rowClicked - 1].Cells[1].Value.ToString(); 

queueGridView.Rows.Insert(rowClicked, column1, column2); 
相關問題