c# - Change Current cell in Cell Enter Event of DataGridView -
i developing form datagridview
.
the result want is:
when user clicks on readonly cell, cursor move editable cell. when user clicks on editable cell, cursor on current editable cell.i create on cell_enter event
(i have reason code on cell_enter
.i have utilize cell_enter).
datagridviewcell cell = mygrid.rows[cursorrow].cells[cursorcol]; mygrid.currentcell = cell; mygrid.beginedit(true);
clicking on editable cell
ok, clicking on readonly cell
give exception error:
error-> operation not valid because results in reentrant phone call setcurrentcelladdresscore function.
so, there solution problem? (when user clicks on readonly cell
, cursor move editable
cell.) edit:the solution want how move cursor other cell not current cell?
i have found solution problem here.
private void mygrid_cellenter(object sender, datagridviewcelleventargs e) { //do stuff application.idle += new eventhandler(application_idle); } void application_idle(object sender, eventargs e) { application.idle -= new eventhandler(application_idle); mygrid.currentcell = mygrid[cursorcol,cursorrow]; }
c# winforms datagridview
No comments:
Post a Comment