DataGridView BeginEdit when form opens -
i have datagridview on form, , want specific cell in first row in edit mode when form opens , when selection changes. datagridview selectmode set "fullrowselect" , in selection change event have following code:
if (dgvreconlist.selectedrows.count == 1) { dgvreconlist.currentcell = dgvreconlist.selectedrows[0].cells["colreferraldate"]; dgvreconlist.beginedit(true); }
that code works charm when change selection. problem when try set desired cell in first row edit mode (using above code) when form opens. first row selected, , desired cell "current" cell, not in edit mode. have tried using above code in forms activate event, load event, , several others no luck.
how can cell in edit mode form opens?
do simple 3 steps.
in form load event -> after loading data dgv
- set dgv property editmode editonenter.
dgvreconlist.currentcell = dgvreconlist[desiredcolumnindex, 0];
dgvreconlist.currentcell.selected = true;
this directly set current sell in edit mode.
Comments
Post a Comment