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

  1. set dgv property editmode editonenter.
  2. dgvreconlist.currentcell = dgvreconlist[desiredcolumnindex, 0];
  3. dgvreconlist.currentcell.selected = true;

this directly set current sell in edit mode.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -