c# - how to add gridview row after copy into row -
i have program want copy top cell current cell when press f7,but problem until user did not type gridview not add row,the question : how can add row when user pressed f7 , notice if user pressed gridview , pressed f7,gridview have 2 empty row,how can manage it?

this code use copy source cell value destination cell when user pressed f7 :
int rowno = datagridview1.currentrow.index - 1; int cellno = datagridview1.currentcell.columnindex; if (rowno >= 0 && cellno >= 0) datagridview1.currentcell.value = datagridview1.rows[rowno].cells[cellno].value;
set datagridview.allowusertoaddrows false. restrict automatically adding of new row when cell value become dirty.
datagridview1.allowusertoaddrows = false; however programmatically can add rows using datagridview1.rows.add(1) etc.
Comments
Post a Comment